The ./scripts
folder contains a npm project supporting 2 scripts
syncCommitteeComittment
prepares the circuits and the trusted setup if necessary. Generates a proof of mapping the SSZ merkelized Sync Committee root to a Poseidon merkelized root by providing it with committee period as input.verifyHeaderSignatures
prepares the circuits and the trusted setup if necessary. Generates a proof that at least 2/3 of the sync committee has signed the specified block header. The script takes as argument only the slot for which a proof must be generated.
Note: It is recommended to use Ubuntu 22.04
- Prior to executing scripts, go to
./circuits
and donpm i
- The following tools must be installed in order for you to successfully execute the bash scripts:
- Build RapidSnark and put
prover
binary at./scripts/build
- NPM
- Node.js
- Circom in order to interact with the circuits
g++
nlohmann-json3-dev
libmpc-dev
nasm
- Build RapidSnark and put
- The following config must be set in order for you to be able to generate a zkey:
- Update the current
max_map_count
of the system by executing:sysctl -w vm.max_map_count=655300
- Add
vm.max_map_count=655300
in/etc/sysctl.conf
in order to persist the change
- Update the current
- Download the PowersOfTau27 file
from SnarkJS and place it
at
./circuits/powers_of_tau/powersOfTau28_hez_final_27.ptau
npm i
cd syncCommitteeComittment && SYNC_COMMITTEE_PERIOD={PERIOD} BEACON_NODE_API={BEACON_NODE_API} bash run_sync_committee_commitment.sh
npm i
cd ./verifyHeaderSignatures && SLOT={SLOT} BEACON_NODE_API={BEACON_NODE_API} bash run_verify_header_signature.sh &
Note -> Might take ~60 seconds as the script is not optimised
Start the processes in the background since it might take a while depending on whether you've compiled / generated the
zkey. A logs
folder for the execution will be created.
PROVER_API={PROVER} BEACON_NODE_API={BEACON_NODE} LIGHT_CLIENT={LIGHT_CLIENT_ADDRESS} yarn ts-node --project tsconfig.json ./updateSyncCommitteeOfContract/index.ts --period {PERIOD} --slot {optional} --rpcUrl {RPC URL} --privateKey {PK}
By default, the slot to be used is the first slot after 2 epochs. If the slot does not have >66% sync committee participation, provide another slot as argument (--slot
)