<!-- Project Template Tagline Motivation What problem is your project is solving? Why is it important and what area of the protocol will be affected? Project description What is your proposed solution? Specification How will you implement your solutions? Give details and more technical information on the project. Roadmap What is your proposed timeline? Outline parts of the project and insight on how much time it will take to execute them. Possible challenges What are the limitations and issues you may need to overcome? Goal of the project What does success look like? Describe the end goal of the project, scope, state and impact for the project to be considered finished and successful. Collaborators Fellows Are there any fellows working with you on this project? Mentors Which mentors are helping you with the project? Resources Provide links to repositories, PRs and other resources which constitute the project. --> # Project Proposal : C bindings for Constantine C bindings for Constantine's **Verkle** cryptography support. ## Motivation & Project Description The [constantine](https://github.com/mratsim/constantine) library provides constant time backends for a number of cryptographic protocols, curves, basics especially the ones used in ethereum. Hence it also provides verkle-ipa in Nim lang which can be integrated by a number of clients during their transition to verkle tries for statelessness. The project aim to create C bindings for verkle cryptography support of Constantine. Once implemented, it should be benchmarked to compare with BLST and other Ethereum cryptographic library bindings. C bindings for Constantine's Verkle cryptography support are of particular note due to active interest from other client teams in using Constantine in this capacity if they become available. C is one among the go-to language for performance and efficiency. It’s fast, powerful, and perfect for optimizing blockchain applications. By creating C bindings for Verkle Tries, we’re making this cutting-edge tech accessible and speedy for developers everywhere. This means Verkle Tries can be seamlessly integrated into various platforms and applications, pushing Ethereum’s capabilities even further. <!-- Verkle Tries are a game-changer for Ethereum, aiming to make the network more efficient and accessible. Large witnesses are a major hurdle to achieving statelessness. With smaller witnesses, we can include them within each block, allowing for block verification using only the data in the block itself. This paves the way for stateless clients that can jump into the network and start validating blocks right away, without the heavy baggage of syncing the entire state. Verkle Tries, only require providing all parent nodes along the paths from each leaf node to the root, plus a little extra proof called an optional. This structuring means Verkle Tries can be much wider than Merkle Trees, drastically reducing witness sizes. --> ### Objectives - [ ] Develop C bindings for the existing Verkle cryptography implementation and BLSt. - [ ] Modifying Nimbus eth2 to detect which backend (native c or constantine) are being used. - [ ] Benchmark and test the implementation. ## Specification ### 1. Interface Design: * Implement C bindings for Verkle cryptography and BLST. * Modify Nimbus eth2 to detect and select the appropriate backend (native C or Constantine). * Implement logic to switch between backends. ### 2. Performance Optimization: The implementation can be optimized using packed structures, minimizing memory allocations and other compile time optimizations. ### 3. Testing and Validation: Testing the implementation, with respect to Nimbus eth2 client. ### 4. Benchmarking: Benchmarking with cryptography libraries like: * BLST Compare metrics like memory and latency overheads. ## Roadmap A rough plan for the project is as follows, however is subject to change as discussed by mentors: ### Week 9 - Week 12 [ August ] * Cover understanding verkle tries including blogs and go-verkle implementation. * Go through existing PRs of C bindings and get familiar with how C bindings are implementated and their working. * Get familiar with Constantine verkle related codebase and identify the changes needed. * Define a technical architecture of the solution. ### Week 13 - Week 16 [ September ] * Implement the C bindings. * Test the generated C bindings for compatibilty and functionality. * Optimize the performance. ### Week 17 - Week 21 [ October ] * Benchmarking and testing. ## Possible challenges There are limited resources for Constantine library, this may pose a challenge. Being new to C bindings and again few resources around these can be challenging in the beginning weeks. ## Goal of the project The goal of the project is to develop efficient C bindings for Constantine's Verkle Trie implementation, facilitating broader integration among clients wishing to leverage constantine for verkle tries. Further benchmarking and comparing with BLST might be helpful for enhancing performance optimzations. ## Collaborators ### Fellow: Richa ### Mentor: * agnxsh * tersec ## Resources * [Anatomy of verkle proof](https://ihagopian.com/posts/anatomy-of-a-verkle-proof) * [Constantine](https://github.com/mratsim/constantine) * [go-verkle](https://github.com/ethereum/go-verkle/blob/master/)