Architecture
Makechain uses a layered architecture with single-chain Simplex BFT consensus and serial per-project execution.
System overview
Layers
Message Layer
Every message is a self-authenticating envelope containing a BLAKE3 hash, Ed25519 signature, and the signer's public key. Messages are structurally validated before entering the mempool.
Consensus Layer
A single Simplex BFT consensus chain orders all messages. The leader proposes blocks by draining the mempool, and the execution engine processes them in two phases.
The two phases are:
- Account pre-pass —
SIGNER_ADD,SIGNER_REMOVE,ACCOUNT_DATA,VERIFICATION_ADD/VERIFICATION_REMOVE,LINK_ADD/LINK_REMOVE,REACTION_ADD/REACTION_REMOVE,PROJECT_CREATE,PROJECT_REMOVE,STORAGE_CLAIM, andFORKare applied serially because they touch sharedowner_address-scoped account state - Serial project execution — Remaining project-scoped messages are grouped by
project_idand executed serially per group against a sharedBatchStoreoverlay on QMDB
This single-chain model achieves high throughput through consensus pipelining (multiple blocks in flight) without the complexity of cross-shard coordination. Non-proposer validators can optionally broadcast subblock payloads — signed mempool snapshots — to help the proposer build fuller blocks (see Consensus).
State Layer
State is stored in a prefix-namespaced key-value store with lexicographic ordering for range scans:
| Prefix | Namespace |
|---|---|
0x02 | Blocks |
0x03 | Tombstones |
0x04 | Account state |
0x05 | Account metadata |
0x06 | Key entries |
0x07 | Key reverse index (pubkey → owner_address) |
0x09 | Verifications |
0x0A | Project state |
0x0B | Project metadata |
0x0C | Project name index |
0x0D | Refs |
0x0E | Commits |
0x0F | Collaborators |
0x10 | Links |
0x11 | Link reverse index |
0x12 | Reactions |
0x13 | Reaction reverse index |
0x14 | Counters |
0x15 | Prune markers |
0x16 | Storage grants |
0x17 | Storage claim settlement markers |
0x18 | Finalized messages |
0x19 | Replay metadata |
QMDB is the single source of truth. During block execution, a BatchStore creates a local mutations overlay on QMDB, then merkleizes and applies the changeset atomically on commit. API queries use a QmdbReadStore for lock-free reads. The StateStore trait keeps the storage backend pluggable.
Content Storage
The consensus layer stores only message metadata (~100-500 bytes). File content (blobs, trees) lives in external storage, referenced by optional content_digest (integrity hash) and url (locator) in commit bundles. These fields are self-attested — validators do not fetch or verify content.
Commonware Primitives
Makechain builds on the Commonware Library:
| Primitive | Usage |
|---|---|
commonware-consensus | Simplex BFT consensus engine |
commonware-broadcast | Block relay broadcast (buffered per-peer caching) |
commonware-p2p | Authenticated peer connections |
commonware-parallel | Execution strategies (Sequential) |
commonware-runtime | Async task execution (tokio backend) |
commonware-cryptography | Ed25519 signing, BLAKE3 digests |
commonware-storage | QMDB merkleized key-value store (source of truth) |
commonware-codec | Binary serialization |
Indexer and event processor
The indexer (cargo build --bin indexer --features indexer) streams finalized blocks from a node via gRPC, decodes messages, and writes them into Postgres. It publishes events to Redis streams for downstream consumers.
The event processor (cargo build --bin event-processor --features event-processor) consumes Redis streams published by the indexer and maintains denormalized query tables in Postgres — projects, accounts, collaborators, links, and reactions. Processors are idempotent and checkpoint-based, allowing safe restarts without data loss.
Both binaries are feature-gated and require external Postgres and Redis instances.
gRPC API
The node exposes a gRPC service on port 50051 (configurable) with:
- grpc-web support — browser clients via HTTP/1.1 (tonic-web)
- CORS — configured for cross-origin grpc-web requests
- Server reflection — runtime service discovery (grpc reflection v1)
- Message streaming —
SubscribeMessageswith type and project_id filters