[−][src]Module damn_vuln_blockchain::chain
Ledger data-structure for the blockchain
Create a new blockchain
use damn_vuln_blockchain::{ asset::AssetLedger, block::{BlockBuilder, Block}, chain::Chain}; fn main() { let chain = Chain::new("My chain"); // crate cahin }
The easiest way to interact with the ledger is via the Chain actor.
Chain supports the followings messages:
- AddBlock: adds a Block to the blockchain
- GetLastBlock: get's the latest Block in the blockchain
- DumpLedger: dumps the entire ledger
- ReplaceChain: replaces a Vec
inside the Chain data-structure, useful when synchronising ledgers
Structs
AddBlock | Add Block send block and network_size network_size is required becuase when InitNetwork is called it sets an offset for Block.serial_no = network_size |
Chain | Ledger data-structure for the blockchain |
DumpLedger | Dumps entire ledger
Useful when forking:
send |
GetLastBlock | Get last block |
ReplaceChain | Replace Chain |