About
Tana consensus service

Tags
No tags available

Languages
TypeScript 88%, Shell 7%, Dockerfile 5%

tana-consensus

validator coordination and leader election service for the Tana blockchain.

overview

tana-consensus implements a practical Byzantine fault tolerant (pBFT) consensus mechanism that coordinates block production across multiple validator nodes. it handles leader election, block proposal broadcasting, and vote collection to achieve network-wide agreement on the canonical chain.

how it works

validators connect to each other via WebSocket and participate in rounds of consensus. each round has a designated leader who proposes a block, and other validators vote on whether to accept it.

consensus flow

round begins
     |
     v
leader elected (round-robin)
     |
     v
leader proposes block
     |
     v
validators verify + vote
     |
     v
2/3+ votes collected
     |
     v
block finalized

leader election

leaders are selected deterministically using round-robin ordering based on validator registration order. this ensures predictable block production while maintaining fairness across validators.

vote collection

validators sign their votes using Ed25519 keys registered with the mesh service. a block is finalized when it receives votes from more than two-thirds of active validators.

architecture

built with TypeScript using WebSocket for peer-to-peer communication. validators discover each other through the mesh service and establish direct connections for low-latency message passing.

the service exposes both an internal API (port 9000) for inter-validator communication and an external API (port 9001) for monitoring and status queries.

integration

tana-consensus runs alongside tana-ledger on each validator node. when consensus finalizes a block, it notifies the local ledger service to apply the state transitions and persist the block.