or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
Deriving the Pedersen Generators
Introduction
This document explains how we will derive the pedersen generators and includes rust and golang code to which you can copy and paste. We will also include a few test vectors to ensure consistency.
The python code
Pedersen Hash vs Pedersen Commitment
You can skip this section, if you just want to figure out how to derive the generators :)
The difference between a pedersen hash and a pedersen commitment is that a commitment explicitly has a generator that is used to hide the committed values.
For example, consider the case where we want to commit to three values \(a,b,c\)
Pedersen Hash
Hash = \(a\cdot G_0 + b \cdot G_1 + c \cdot G_2\)
Pedersen Commitment
Commitment = \(a\cdot G_0 + b \cdot G_1 + c \cdot G_2 + r \cdot H\)
where \(r\) is a random element
It's a bit confusing because when we commit to a polynomial without zero knowledge, we says pedersen commitment and not pedersen hash.
Rationale
For security, the generators used in a pedersen hash must be created in such a way that the relative discrete logarithm between generators is unknown. If this is not the case, then a malicious actor can commit to any value that they desire. At a high level, for each generator that I know the relative discrete logarithm for, that generator becomes redundant. Another way to see it is that, N generators define an N-dimensional vector space and knowing the discrete logarithm between them makes them no longer linearly independent, ie they do not form a basis.
Methodology
We follow the simplest methodology which is try-and-increment. This procedure does not need to be constant time and should follow the (Nothing Up My Sleeve) convention.
Try and Increment (MapToGroup) was first introduced at 3.2 here: https://hovav.net/ucsd/dist/sigs.pdf
In short we:
b
to be 0 or 1z
Pseudo code
Correctness checks
It is important that:
Multiply by Order or Cofactor
There are two ways to check for the point being in the correct subgroup.
Recommendation
This document uses the first method.
Extra Dependencies
Lexographically Largest
For a field of size \(q\), we denote a reduced field element \(z\) is lexographically larger than it's negation if \(z > (q-1)/2\).
Library Assumptions
Seed
The current seed being used is:
eth_verkle_oct_2021
Incase the seed does change in the future, one only needs to change the month and year parts.
Golang
(Imperative)
Rust
(Functional)
Test Vectors
First point
22ac968a98ab6c50379fc8b039abc8fd9aca259f4746a05bfbdf12c86463c208
256th point
c8b4968a98ab6c50379fc8b039abc8fd9aca259f4746a05bfbdf12c86463c208
sha256 of all points
c390cbb4bc42019685d5a01b2fb8a536d4332ea4e128934d0ae7644163089e76
Golang
Rust
Future changes
Serialisation
The serialisation that the Rust and Python library uses is non-standard and so once this issue is closed, the test vectors will need to be updated:https://github.com/arkworks-rs/algebra/issues/330
The Golang library used the correct serialisation format, however it was modified to match the arkworks format for interopability.
Seed
It's possible that the seed does change; maybe "eth_verkle_2021" is better, or maybe "verkle_trie". It's not a big issue in my opinion, but if you are reading this from the future, this could be a reason why your test vectors are not matching up.