Skip to content
LogoLogo

Architecture

Makechain uses a layered architecture with single-chain Simplex BFT consensus and serial per-project execution.

System overview

Makechain architecture: clients connect via gRPC to the validator node containing API, mempool, Simplex BFT consensus, execution engine, and QMDB

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.

Two-phase execution: serial account pre-pass, then serial per-project execution via BatchStore, producing a BLAKE3 state root

The two phases are:

  1. Account pre-passSIGNER_ADD, SIGNER_REMOVE, ACCOUNT_DATA, VERIFICATION_ADD / VERIFICATION_REMOVE, LINK_ADD / LINK_REMOVE, REACTION_ADD / REACTION_REMOVE, PROJECT_CREATE, PROJECT_REMOVE, STORAGE_CLAIM, and FORK are applied serially because they touch shared owner_address-scoped account state
  2. Serial project execution — Remaining project-scoped messages are grouped by project_id and executed serially per group against a shared BatchStore overlay 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:

PrefixNamespace
0x02Blocks
0x03Tombstones
0x04Account state
0x05Account metadata
0x06Key entries
0x07Key reverse index (pubkey → owner_address)
0x09Verifications
0x0AProject state
0x0BProject metadata
0x0CProject name index
0x0DRefs
0x0ECommits
0x0FCollaborators
0x10Links
0x11Link reverse index
0x12Reactions
0x13Reaction reverse index
0x14Counters
0x15Prune markers
0x16Storage grants
0x17Storage claim settlement markers
0x18Finalized messages
0x19Replay 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:

PrimitiveUsage
commonware-consensusSimplex BFT consensus engine
commonware-broadcastBlock relay broadcast (buffered per-peer caching)
commonware-p2pAuthenticated peer connections
commonware-parallelExecution strategies (Sequential)
commonware-runtimeAsync task execution (tokio backend)
commonware-cryptographyEd25519 signing, BLAKE3 digests
commonware-storageQMDB merkleized key-value store (source of truth)
commonware-codecBinary 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 streamingSubscribeMessages with type and project_id filters