RUST_LOG=info cargo run
This project utilizes a hash chain to ensure fairness and unpredictability in block production.
-
Generation of Hash Chain:
At the start of each epoch, a new hash chain is generated by invokingHashChain::new()
.
This chain is a sequence of precomputed hash values. -
Commitment via Final Hash:
The last hash in the chain serves as a commitment for the epoch.
This commitment is broadcast to the network as aHashChainCom
message, ensuring all nodes share a common, verifiable reference. -
Randomness for Block Proposal:
During mining events, a specific hash is selected from the chain based on the epoch's progression.
This hash acts as a seed, determining which node is eligible to propose the next block.
By relying on a precommitted hash chain, the protocol prevents tampering and manipulation. -
Verification Process:
As epochs progress, parts of the hash chain are revealed, allowing nodes to verify that the selection process aligns with the initial commitment.
This mechanism ensures that the randomness and fairness in the block production process are maintained across the peer-to-peer network.
cargo run --bin circuits
stat -f"%z bytes" proof.bin
expander-exec \
--fiat-shamir-hash SHA256 \
--poly-commitment-scheme Raw \
prove \
--circuit-file circuit.txt \
--witness-file witness.txt \
--output-proof-file proof.bin
expander-exec verify \
--circuit-file circuit.txt \
--witness-file witness.txt \
--input-proof-file proof.bin
hyperfine --warmup 3 'expander-exec verify \
--circuit-file circuit.txt \
--witness-file witness.txt \
--input-proof-file proof.bin'