Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Getting Started – Makechain
Skip to content

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:50052

The node starts Simplex BFT consensus and a gRPC server with grpc-web support.

Node Flags

FlagDefaultDescription
--grpc-addr0.0.0.0:50051gRPC listen address
--p2p-addr0.0.0.0:50052P2P listen address
--seed0Validator key seed (deterministic derivation)
--data-dir.makechainData directory for snapshots
--snapshot-interval100Save state snapshot every N blocks (0 = disabled)
--metrics-addr0.0.0.0:9090Prometheus metrics endpoint
--networkdevnetNetwork: devnet, testnet, or mainnet
--validatorsAdditional validator public keys (hex, comma-separated)
--bootstrappersBootstrap peers: pubkey@host:port (comma-separated)
--rate-limit-burst100Max burst tokens per account (0 = disabled)
--rate-limit-rate10.0Tokens replenished per second per account
--mempool-capacity100000Maximum pending messages in mempool
--max-block-messages10000Maximum 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