blockchaindev

Code-first learning

Build blockchains, properly.

Practitioner-grade tutorials with working Rust. How consensus, ZK, and VMs actually work — explained from first principles, no fluff.

block.rs
pub struct Block {
    pub height: u64,
    pub prev_hash: Hash,
    pub timestamp: u64,
    pub txs: Vec<Transaction>,
}

impl Block {
    /// A block's hash commits to its header AND its transactions.
    pub fn hash(&self) -> Hash {
        let mut h = Hasher::new();
        h.update(&self.height.to_le_bytes());
        h.update(self.prev_hash.as_bytes());
        h.update(&self.timestamp.to_le_bytes());
        h.finalize()
    }
}