Full Node - Algorand Specifications
Algorand Specifications
The algod Full Node is responsible for:
- Validating and propagating transactions and blocks,
- Maintaining the blockchain state, either fully ( Archival) or partially ( Non Archival), as defined in the Ledger,
- Participating in the consensus protocol, as outlined in the ABFT specification.
The pseudocode below outlines the main steps involved when initializing an algod Full Node:
Algorithm1: Full Node InitializationAlgorithm 1: Full Node Initialization
1: function FullNode.Start(rootDir,nodeConfig,phonebookAddrs,genesisBlock) 2: node ← new FullNode 3: node.log ← Logger(nodeConfig) 4: node.genesisBlock.ID ← genesisBlock.ID() 5: node.genesisBlock.ID ← genesisBlock.Hash() 6: Network Initialization 7: if nodeConfig.EnableHybridMode then 8: node.Network ← CreateHYBNetwork(phonebookAddrs) 9: else if nodeConfig.EnableP2P then 10: node.Network ← CreateP2PNetwork(phonebookAddrs) 11: else 12: node.Network ← CreateWSNetwork(phonebookAddrs) 13: end if 14: Crypto Resource Pools Initialization 15: node.CryptoPool ← CreateExecutionPool() 16: node.CryptoPool.lowPriority ← CreateBacklogPool() 17: node.CryptoPool.highPriority ← CreateBacklogPool() 18: Ledger Initialization 19: ledgerPaths ← ResolvePaths(rootDir,nodeConfig) 20: node.Ledger ← LoadLedger(ledgerPaths,genesisBlock) 21: Account Management 22: Registry ← ParticipationRegistry() 23: node.AccountManager ← CreateAccountManager(Registry) 24: LoadParticipationKeys(node) 25: Transaction Pool Initialization 26: node.TxPool ← CreateTxPool(node.Ledger) 27: RegisterBlockListeners(node.TxPool) 28: Services Initialization 29: node.BlockService ← CreateBlockService() 30: node.LedgerService ← CreateLedgerService() 31: node.TxPoolService ← CreateTxPoolSyncer() 32: node.AgreementService ← CreateAgreementService() 33: node.CatchupService ← CreateCatchupService() 34: node.StateProofService ← CreateStateProofService() 35: node.HeartbeatService ← CreateHeartbeatService() 36: return node 37: end function
Important
IMPLEMENTATION:
Full Node initialization reference implementation.
The network layer is set up depending on the configuration:
- WSWS (WebSocket) for the Relay Network setups,
- P2PP2P for Peer-to-Peer Network, or
- HYBHYB for the P2PP2P-WSWS Hybrid Network, for nodes operating in a unified network layer.
The network layer manages:
- Peer discovery using phonebook addresses,
- Connection pools, and
- Message routing.
For further details on the network layer, refer to Algorand Network non-normative specification.
The node initializes worker pools for handling cryptographic tasks with priority queues:
- CryptoPool handles general-purpose cryptographic operations,
- CryptoPool.lowPriority and CryptoPool.highPriority handle transaction verification, grouped by priority.
For further details on the transaction validation, see the Ledger specification.
For further details on the cryptographic primitives and algorithms, see the Crypto specification.
The node loads its local view of the blockchain state from disk (accounts, blocks, protocol data, etc.), based on the specified genesis configuration.
If the Ledger is empty, it initializes the required structures.
It also validates:
- The genesis configuration, and
- Ledger integrity.
For further details on the Ledger entities, see the Ledger specification.
The node prepares for consensus participation and registered account tracking by:
- Creating and managing a registry of participation keys,
- Loading any pre-existing participation keys from disk,
- Setting up participation key rotation.
For further details on the Algorand keys, see the Keys specification.
For further details on the key registration transactions, see the Ledger specification.
The node creates the Transaction Pool (TxPool), which:
- Accepts and validates new transactions,
- Maintains the queue of uncommitted transactions,
- Manages transaction synchronization across the network,
- Creates Block Listeners reacting to new blocks to prune already committed transactions and update pending transactions.
For further details on the Transaction Pool, see the Ledger non-normative specification.
Finally, the node launches all essential background services:
- Catchup Service,
- Agreement Service,
- Transaction Pool Syncer Service,
- Block Service,
- Ledger Service,
- Transaction Handler,
- State Proof Worker.
- Heartbeat Service.