Single Secret Leader Election Snark (Block Proposer privacy Protocol using ZKSnarks):
Public parameters:
- A public random number
m
(emitted by the random beacon). - The roothash of all the participants’ public keys:
rh
. h = hash(signed(m))
Secret parameters:
- Sign the message
m
by all participants:signed(m)
- The signer’s public key:
pk
- Merkle path:
mp
Protocol
- Generate
N
signature pairs pub/priv pair, we generate a SNARK (since participants have to send proof that they are eligible). - We choose one party
hash h
to be the block proposer. - The party that was chosen will publish the sig that proves they are the right person.
- The other parties verify the sig to verify if the msg m was actually signed by the corresponding private key.
Checks performed by the ZK-SNARK:
-
The public key belongs to one of the participants: the Merkle path
mp
leads from the public keypk
to the root hashrh
. -
Signed(m)
checks out against the public keypk
and the random numberm
. -
Hash(signed(m))
given in the public parameters is the hash ofsigned(m)
given in the secret parameters. -
Signed(m)
in the secret parameters is the same `m given in the public parameters.
Fetch dependencies from their GitHub repos:
git clone [email protected]:HarryR/ethsnarks.git
cd ethsnarks
make
in depends folder do
git clone https://github.com/scipr-lab/libsnark.git
mkdir build && cd build
LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:"${LD_LIBRARY_PATH}"
CPATH=/usr/local/opt/openssl/include:"${CPATH}"
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:"${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH CPATH PKG_CONFIG_PATH
CPPFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig cmake -DWITH_PROCPS=OFF -DWITH_SUPERCOP=OFF ..
make
In the SSLES folder:
Create the Makefile:
$ mkdir build && cd build
LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:"${LD_LIBRARY_PATH}"
CPATH=/usr/local/opt/openssl/include:"${CPATH}"
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:"${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH CPATH PKG_CONFIG_PATH
CPPFLAGS=-I/usr/local/opt/openssl/include LDFLAGS=-L/usr/local/opt/openssl/lib PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig cmake -DWITH_PROCPS=OFF -DWITH_SUPERCOP=OFF ..
Then, to compile the library, tests, and profiling harness, run this within the build directory:
$ make