This is a naive and native Rust blockchain protocol implementation, very much WIP. From this experiment will eventually emerge a series of articles on the principles of distributed consensus, and a step-by-step implementation of a blockchain protocol in Rust.
node crate is the entry point: it sets up a TCP server for node-to-node communication, parsing protocol messages in the MessagePack format.
A protocol message has the following structure:
| MAGIC ("BLOCK") | PROTOCOL VERSION (32B) | MSG TYPE (32B) | MSG PAYLOAD (32B) | PAYLOAD |
While TCP is fine for broadcasting transactions, blocks, and other technical stuff, users need a more human-friendly channel of communication witht their local node in order to start transactions, check blockchain status, etc. This implementation aims at providing a JSON-RPC server through HTTP (very much a la Bitcoin).
jsonrpc crate provides data structures that model the JSON-RPC protocol model (V2.0).
merkle crate provides for now a simple immutable binary tree implementation.
It aims at providing a sensible Merkle-tree implementation, which I expect will warrant its separate post
(implementing data structures in Rust is