this is a draft project-proposal, current goal of this project is to get benchmark of in-circuit pedersen hash and commitment used in verkle tries vs keccak hash used in MPT, overcomplicating things leads nowhere
VKT - verkle trie
MPT - merkle patricia trie
Purpose of this document is to describe project proposal for creating a verkle trie data structure in-circuit which means execution of the state changes can be efficiently proven in zk circuit (because of the removal of main bottleneck - keccak-sha3)
In order to make ethereum became more scalable, decentralized and secure new data structure for storage is proposed: Verkle Trie. More on that here:
https://verkle.info/
(not sure if VKT adds more security to Ethereum, i guess MPT is more secure than VKT because of the quantum security of keccak vs ECC, but still we should be good for next 5-10 years (there are no quantum computers yet)) - at least that's my understanding for now
EDIT:
there are "functional commitements" which are post-quantum safe, additively homomorphic but they require some kind of trusted setup, i'm learning if this can be efficient in-circuit, here's the paper: https://eprint.iacr.org/2022/1368.pdf
Comment from Lev (https://github.com/Lev-Stambler/CP22-function-commitment) on his work on this functional commitment and his answer:
2 reasons the transition is happening from MPT to VKT is because it will help ethereum reach weak statelessness and help onboard more validators(more decentralisation), but also because it is much cheaper and easier to prove verkle trie than merkle trie in circuit for zk rollups(more scalability), which means it should be easier to have type 1 zk-evm (because of the removal of keccak and having eliptic curve operations (pedersen commitment + IPA)) - that should be much eaiser to verify in zk-circuit.
I've asked in Ethereum R&D discord "verkle-trie-migration" question if anyone is already working on VKT in-circuit and seems there is no such project, so I think it make sense working on it. Zhang Zhuo (https://github.com/lispc/) from Scroll team already offered help.
I've got this idea while reading the bandersnatch eliptic curve paper: https://eprint.iacr.org/2021/1152.pdf and doing the small hackathon project.
So the curve is chosen to be friendly for zk-snarks and efficient for scalar multiplication and pedersen commitments should be efficient in-circuit. Goal of this project is to learn about all these things and benchmark against MPT primitives(keccak mainly) in-circuit implementation. For example proving time.
High overview of things that we need:
Since Ethereum PSE team is working on ZKEVM type 1 using halo2 library, I would like to learn more about this and start writing circuits for VKT. So far I have written small projects like:
https://github.com/dragan2234/fibosquared-halo2
Also, for the first iteration I think we could only have VKT circuit working correctly without integration with zkevm project. Then we would benchmark against MPT circuit. Example of benchmark:
Since development of MPT circuit for zkevm project lasted 2 years, this project is not an easy task to do but still shouldn't be that complicated. Any output by the end of the cohort should be useful.
Helpful links:
TBD.
update on challenges:
update 2 on challenges:
update 3:
update 4:
comment from https://github.com/asanso whether banderwagon would be effcient in-circuit: Yes, it would give similar benchamarks as bandersnatch r1cs contraints benchmarks from https://github.com/zhenfeizhang/bandersnatch#examples "Examples" section.
Benchmarks:
bandersnatch:
cs for base var: 5
cs for scalar var: 256
cs for mul : 2869
cs for result var : 27
cs for equality : 20
total constraints : 3177
jubjub:
cs for base var: 21
cs for scalar var: 256
cs for mul : 3325
cs for result var : 21
cs for equality : 2
bandersnatch with the glv:
cs for setup: 16
cs for endomorphism var: 6
cs for scalar decomposition var: 405
cs for msm: 2176
cs for result var : 16
cs for equality : 2
total constraints : 2621
There are few people interested in this, and not all of them from the EPF program. I will add everyone here when we kickstart.
MORE UPDATES(will clean up the whole file later):