zkAttestor
Scalable on-chain trustless attestations to data from any past Ethereum block or state.
Project overview
This repository provides implementations of account, storage, and transaction proofs for Ethereum. Together, these enable a user to generate validity proofs for data from any current or past Ethereum block or state using a trusted block hash alone.
These implementations are for demonstration purposes only. These circuits are not audited, and this is not intended to be used as a library for production-grade applications.
Install dependencies
- Run
yarnat the top level to install npm dependencies (snarkjsandcircomlib). - You'll also need
circomversion >= 2.0.2 on your system. Installation instructions here. - Building these circuits requires a Powers of Tau file with
2^24constraints in thecircuitssubdirectory with the namepot24_final.ptau. One such file can be downloaded from the Hermez trusted setup here. - Finally, you'll need to follow the setup instructions at Best Practices for Large Circuits.
Building proving keys and witness generation files
We provide three circuits, which enable attestations to all current or historical Ethereum data available from an archive node with the exception of receipts, which are WIP:
eth_block_hash: Prove state, transaction, and receipt roots corresponding to a block hash.eth_addr_storage: Prove the contents of a storage slot for an account from a block hash.eth_tx_proof: Prove the contents of a transaction from a block hash.
Run yarn build:eth_block_hash, yarn build:eth_addr_storage, yarn build:eth_tx_proof at the
top level to compile proving keys and witness generators for each file.
These circuits are fairly large and require special hardware and setup to run: see Best Practices for Large Circuits.
Testing
Run yarn test at the top level to run tests. Note that these tests only test correctness
of witness generation.
Acknowledgements
We use a circom implementation of keccak from Vocdoni as well as the eth-mpt Python library by popzxc.