## Keyboard shortcuts

Press `←` or `→` to navigate between chapters

Press `S` or `/` to search in the book

Press `?` to show this help

Press `Esc` to hide this help

- Auto
- Light
- Dark

# Algorand Specifications

The pseudocode below outlines how a Full Node is gracefully shut down.

This process ensures all services are stopped, garbage collection is performed,
resources are released, and the internal state is properly cleaned up.

By following this structured approach, the node avoids corrupting data or leaving
the Algorand network in an inconsistent state, which is critical for maintaining
the integrity of the system.

* * *

**Algorithm 3: Full Node Shutdown**  
1: function FullNode.Stop()  
2: Network Cleanup  
3: node.Network.StopHandlers()  
4: node.Network.StopValidatorHandlers()  
5: if ¬node.nodeConfig.StopNetwork then  
6: node.Network.Stop()  
7: endif  
8: Service Shutdown  
9: if ∃node.CatchpointCatchupService then  
10: node.CatchpointCatchupService.Stop()  
11: else  
12: Full Node Services  
13: node.StopAllServices()  
14: endif  
15: Resource Cleanup  
16: node.TxPool.Stop()  
17: Final Cleanup  
18: node.Ledger.Close()  
19: Post-Shutdown Cleanup  
20: WaitMonitoringRoutines()  
21: node.AccountManager.Registry.Close()  
22: for Handler∈node.DatabaseHandlers do  
23: Handler.Close()  
24: endfor  
25: endfunction

* * *

> Important  
> **IMPLEMENTATION:**  
> Full node shutdown [reference implementation](https://github.com/algorand/go-algorand/blob/e60d3ddd1d63e60f32bda6935554b34fdb0e1515/node/node.go#L444-L487).

This structured shutdown process helps ensure that Full Nodes exit cleanly, preserving
correctness, avoiding data leaks, and minimizing node and network risk.
