This repository contains simplified implementations of a Blockchain, Merkle Tree, Zk-SNARK, and Zk-Rollup.
Simplified implementations use Vec<u8>
for all data and variables to keep things straightforward. Here's what we've got:
Our zksnark
module includes:
ProvingKey
structVerificationKey
structcreate_proof()
functionverify_proof()
function
The merkle_tree
module provides:
MerkleTree
struct- Root calculation
- Leaf inclusion verification
The ZkRollupTransaction
struct includes:
inputs
,outputs
,public_inputs
,snark_proof
, andsnark_input
fieldsnew()
function for generationverify()
function for verification
Our Blockchain
struct offers:
- Storage of
ZkRollupTransaction
s in a HashMap new()
function for creating a new blockchain instanceadd_transaction
method for adding new transactions
This project is licensed under the MIT License - see the LICENSE.md file for details.