wip
The diagram below shows the architecture behind the network layer
(src/network.rs): peers discover each other via mDNS, connect over
TCP with Noise encryption, and exchange blocks and transactions
through gossipsub.
+---------------------+ +---------------------+
| Node A | | Node B |
| 12D3…KEEQ | | 12D3…mkP2 |
| tcp/39665 | | tcp/37379 |
+----------+----------+ +----------+----------+
| |
| <-------- 1. mDNS discovery ------------> |
| |
| -------- 2. TCP + Noise handshake ------> |
| |
| <-------- 3. gossipsub GRAFT -----------> |
| |
| ================ mesh formed ============ |
| |
| -------- 4. publish --------------------> |
| (blocks/1, txs/1) |
| |
xicochain uses the UTXO model (src/types.rs), Bitcoin-style: transactions consume previous outputs and create new ones. The fee is implicit, the gap between input and output sums, set by the sender, collected by the miner.
Block
├── BlockHeader
│ ├── previous_block_hash [u8; 32] link to parent block
│ ├── merkle_root [u8; 32] commits to all transactions
│ ├── timestamp u64 unix seconds
│ ├── difficulty u32 required leading zero bits
│ └── nonce u64 PoW search variable
└── transactions: Vec<Transaction>
├── inputs: Vec<TxInput> outputs being spent
│ ├── previous: OutPoint (txid, index) of the output
│ ├── signature proof of ownership
│ └── pubkey
└── outputs: Vec<TxOutput> new coins created
├── amount: u64
└── recipient
Departures from Bitcoin: u64 timestamps and nonces, plain leading-zero-bits difficulty instead of nBits, single SHA-256 instead of double.