Epoch
An epoch is a unit of time when validators of the network remain constant. It is measured in blocks:
- Both
testnetandmainnethave an epoch duration of 43,200 blocks. Ideally epochs last about 12 hours, since blocks are created every second (in reality, they take slightly longer to be created). - You can view this setting by querying the
protocol_configRPC endpoint and searching forepoch_length.
Note: Nodes garbage collect blocks after 5 epochs (~2.5 days) unless they are archival nodes.
Example:
- JSON
- HTTPie
{
"jsonrpc": "2.0",
"id": "dontcare",
"method": "EXPERIMENTAL_protocol_config",
"params": {
"finality": "final"
}
}
http post https://rpc.testnet.near.org jsonrpc=2.0 id=dontcare method=EXPERIMENTAL_protocol_config \
params:='{
"finality": "final"
}'