# 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](https://specs.algorand.co/ledger/ledger-overview),
- **Participating in the consensus protocol**, as outlined in the [ABFT specification](https://specs.algorand.co/abft/abft).

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](https://github.com/algorand/go-algorand/blob/e60d3ddd1d63e60f32bda6935554b34fdb0e1515/node/node.go#L184-L347).

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](https://specs.algorand.co/network/network-overview).

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](https://specs.algorand.co/ledger/ledger-overview).

> For further details on the cryptographic primitives and algorithms, see the Crypto [specification](https://specs.algorand.co/crypto/crypto).

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](https://specs.algorand.co/ledger/ledger-overview).

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](https://specs.algorand.co/keys/keys-overview).

> For further details on the key registration transactions, see the Ledger [specification](https://specs.algorand.co/ledger/ledger-overview).

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](https://specs.algorand.co/ledger/non-normative/ledger-nn-txpool).

Finally, the node launches all essential background services:

- [Catchup](https://specs.algorand.co/node/non-normative/node-nn-sync) Service,
- [Agreement](https://specs.algorand.co/abft/abft) Service,
- [Transaction Pool](https://specs.algorand.co/ledger/non-normative/ledger-nn-txpool) Syncer Service,
- [Block](https://specs.algorand.co/ledger/ledger-block) Service,
- [Ledger](https://specs.algorand.co/ledger/ledger) Service,
- [Transaction](https://specs.algorand.co/ledger/ledger-transactions) Handler,
- [State Proof](https://specs.algorand.co/crypto/crypto-state-proofs) Worker.
- [Heartbeat](https://specs.algorand.co/ledger/ledger-txn-heartbeat) Service.
