Getting Started
Makechain is a Rust crate implementing the core protocol with a node binary and CLI client. This guide walks you through building, running a node, and submitting your first message.
Prerequisites
- Rust nightly 1.93+ (edition 2024)
- protoc (protobuf compiler) on your PATH
Build
git clone https://github.com/officialunofficial/makechain.git
cd makechain
cargo build
Run a Node
Start a single-validator development node:
cargo run --bin node -- --grpc-addr 127.0.0.1:50051 --p2p-addr 127.0.0.1:50052The node starts Simplex BFT consensus and a gRPC server with grpc-web support.
Node Flags
| Flag | Default | Description |
|---|---|---|
--grpc-addr | 0.0.0.0:50051 | gRPC listen address |
--p2p-addr | 0.0.0.0:50052 | P2P listen address |
--seed | 0 | Validator key seed (deterministic derivation) |
--data-dir | .makechain | Data directory for snapshots |
--snapshot-interval | 100 | Save state snapshot every N blocks (0 = disabled) |
--metrics-addr | 0.0.0.0:9090 | Prometheus metrics endpoint |
--network | devnet | Network: devnet, testnet, or mainnet |
--validators | Additional validator public keys (hex, comma-separated) | |
--bootstrappers | Bootstrap peers: pubkey@host:port (comma-separated) | |
--rate-limit-burst | 100 | Max burst tokens per account (0 = disabled) |
--rate-limit-rate | 10.0 | Tokens replenished per second per account |
--mempool-capacity | 100000 | Maximum pending messages in mempool |
--max-block-messages | 10000 | Maximum messages per block |
Use the CLI
Generate a keypair
cargo run --bin cli -- keygen
# Output:
# secret: <hex-encoded 32-byte seed>
# public: <hex-encoded 32-byte public key>Register your key on-chain
cargo run --bin cli -- register-key --secret <your-secret> --mid 1
# Output: accepted: hash=<message-hash>Create a project
cargo run --bin cli -- create-project --secret <your-secret> --mid 1 --name "my-project"
# Output: accepted: project_id=<content-addressed-project-id>Manage projects
# Set project metadata
cargo run --bin cli -- set-project-metadata --secret <secret> --mid 1 \
--project-id <hex> --description "updated desc"
# Add a collaborator
cargo run --bin cli -- add-collaborator --secret <secret> --mid 1 \
--project-id <hex> --collaborator-mid 2
# Fork a project
cargo run --bin cli -- fork-project --secret <secret> --mid 1 \
--source-project-id <hex> --source-commit-hash <hex> --name "my-fork"Query state
# Get account info
cargo run --bin cli -- get-account --mid 1
# Get project info
cargo run --bin cli -- get-project --id <project-id-hex>
# Look up project by name
cargo run --bin cli -- get-project-by-name --mid 1 --name "my-project"
# List all projects
cargo run --bin cli -- list-projects
# List refs, commits, collaborators
cargo run --bin cli -- list-refs --project-id <hex>
cargo run --bin cli -- list-commits --project-id <hex>
cargo run --bin cli -- list-collaborators --project-id <hex>
# List account keys
cargo run --bin cli -- list-keys --mid 1
# Subscribe to live message stream
cargo run --bin cli -- subscribe
Using as a Library
You can also use makechain as a Rust library for building and verifying messages:
use makechain::message::{build_message, verify_message};
use makechain::proto::{self, message_data::Body, MessageType, Network};
use ed25519_dalek::SigningKey;
use rand::rngs::OsRng;
// Generate a signing key
let signing_key = SigningKey::generate(&mut OsRng);
// Create a PROJECT_CREATE message
let data = proto::MessageData {
r#type: MessageType::ProjectCreate as i32,
mid: 1,
timestamp: 1000,
network: Network::Devnet as i32,
body: Some(Body::ProjectCreate(proto::ProjectCreateBody {
name: "my-project".to_string(),
visibility: proto::Visibility::Public as i32,
description: "A new project".to_string(),
license: "MIT".to_string(),
})),
};
// Sign and wrap the message
let message = build_message(data, &signing_key).unwrap();
// The message hash IS the project_id (content-addressed)
let project_id = &message.hash;
// Verify the message
assert!(verify_message(&message).is_ok());
Run Tests
cargo test # Run all 490 tests
cargo test <name> # Run a specific test
Next Steps
- Protocol Overview — understand message semantics
- Message Types — all available operations
- Architecture — system design and execution model
- API Reference — gRPC endpoints