Node state and upgrades
Know whether a node can answer: health, the warming-up answers with the block store progress, sync state, network upgrades, the release operators must run, and the upgrade notice.
A client that talks to a node should know, before it trusts an answer, whether the node is started, synced and on the release the network needs. These routes tell it. All are public GET routes under /api/v1.
Health #
GET /health is the cheap probe (cached 1 second). Use it for load balancers and before a batch of calls.
curl -s https://givelotus.org/api/v1/health{"status":"ok","height":1433874,"best_block_hash":"00000000010d37f7...","median_time":1795721123,"ibd":false,
"indexer":{"mode":"sync","tip_height":1433874,"index_height":1433874,"behind":0},
"uptime_seconds":13122,"version":12050900,"subversion":"/lotusd:12.5.9(EB32.0)/"}| Field | Meaning |
|---|---|
status | ok, or syncing during the initial block download |
height, best_block_hash, median_time | The node's tip and its median time past |
ibd | true during the initial block download |
indexer | The explorer indexer: mode (sync or async), tip_height, index_height, behind. With async, more counters follow. Address answers wait for behind to be 0 |
version | Numeric version: 12050900 is 12.5.9 |
subversion | The user agent the node announces on P2P |
While the node starts #
The HTTP port opens before the chain is loaded. Until the node is ready, every route answers:
HTTP/1.1 503 Service Unavailable
Retry-After: 2
X-Node-State: starting
{"error":"node_warming_up","message":"Rebuilding module indices from genesis…","status":503}message says what the node is doing. Retry after Retry-After; do not treat it as an error of your request. The Chronik routes answer the same state in their own format.
The first start of 12.5.9 converts the block files into one SQLite database, a few minutes on mainnet. While that conversion runs (or when the node refused to start for lack of disk space), the 503 body also carries blockstore, the conversion's progress (the values below are an example):
{"error":"node_warming_up","message":"...","status":503,
"blockstore":{"mode":"sqlite","phase":"copy","active":true,"percent":41,
"blocks_done":588000,"blocks_total":1432760,"bytes_done":2210000000,"bytes_total":5400000000,
"files_done":120,"files_total":290,"started_at":1795700000,"phase_started_at":1795700012,
"rate_bytes_per_s":11000000,"eta_seconds":290,"resumed":false,"refusal":null,"message":"..."}}blockstore field | Meaning |
|---|---|
mode | sqlite or flat (-blockstore) |
phase | none (nothing to convert), preflight, copy, filters, verify, commit_index, txindex, remove_flat, done, refused or failed |
active | A conversion is running now |
percent, blocks_*, bytes_*, files_* | Progress, done and total |
rate_bytes_per_s, eta_seconds | Speed and time left (-1 when unknown) |
resumed | The conversion resumed after a stop |
refusal | null, or why the node refused to start (for example, not enough free disk) |
The same object is in GET /chain, GET /chain/sync and getblockchaininfo once the node runs, and in GET /api/v1/startup/status, the state of every startup step.
Sync state #
| Route | Use |
|---|---|
GET /chain | Tip, difficulty, replay_protection, blockstore, network |
GET /chain/sync | height, headers, initial_block_download, verification_progress, blocks and transactions a second, remaining_blocks, eta_seconds, indexer, blockstore |
GET /chain/tip | The tip block only |
While the node is not at the tip, every /addresses and /scripts route answers 503 syncing with the node's height and headers, never an old balance. Ask another node, or wait.
Network upgrades #
GET /upgrades lists every network upgrade of the chain the node is on, with its activation time and state, and says which release operators must run before the next one.
curl -s https://givelotus.org/api/v1/upgradesconst u = await (await fetch('https://givelotus.org/api/v1/upgrades')).json();
const next = u.upgrades.find(x => x.name === u.next);
console.log(next.display, next.activation_time - u.tip_mtp, 's to go');
console.log('operators must run', u.required_release, 'or later; this node:',
u.required_release_met ? 'ready' : 'upgrade');import json, urllib.request
req = urllib.request.Request("https://givelotus.org/api/v1/upgrades",
headers={"User-Agent": "my-app/1.0"})
u = json.load(urllib.request.urlopen(req))
print(u["next"], u["required_release"], u["required_before"], u["required_release_met"]){"chain":"main","tip_height":1433877,"tip_mtp":1795721627,"initial_block_download":false,
"node_version":"v12.5.9","client_version":12050900,"next":"napoleon",
"required_release":"12.5.9","required_before":1797886200,"required_release_met":true,
"upgrades":[ ...,
{"name":"napoleon","label":"Napoleon","display":"Napoleon","activation_time":1797886200,"active":false,
"active_since_height":null,"seconds_until":2164573,"overridden":false,
"features":["mmv2","mmv3","mmv3-tracks","contracts","coinbase-height","miner-fund"],
"required_release":"12.5.9","required_release_source":"option","upstream_name":"secondKings",
"feature_times":{"mmv2":{"activation_time":1797886200,"active":false}, ...}},
{"name":"firstChronicles","label":"1st Chronicles","display":"Jena","activation_time":1813587000, ...}]}| Field | Meaning |
|---|---|
name | The identifier (napoleon, firstChronicles, ...). Match on it in code: it never changes |
label | The former display name, kept for older programs |
display (12.5.9) | The name to show people: Pavie, Detmold, Hase, Toulon, Lodi, Arcole, Rivoli, Marengo, Ulm, Austerlitz, Napoleon, Jena |
activation_time | Median time past at which it activates. Upgrades activate by the chain's median time past, never by height or clock |
active, active_since_height, seconds_until | State on this node. seconds_until counts against tip_mtp, which runs 10 to 15 minutes behind the clock |
overridden | An activation-time option moved it (test networks only) |
required_release, required_release_source (12.5.9) | The release operators must run before this upgrade, and where the number comes from; null when the node states none |
top-level next, required_release, required_before, required_release_met (12.5.9) | The same for the next upgrade: the release, its deadline (the activation time), and whether this node's build is that release or newer |
Where the required release comes from #
The number is the highest of three sources, named in required_release_source:
| Source | Value |
|---|---|
builtin | Written in the code: 12.5.8 for Napoleon. This is the minimum for the chain's rules |
option | The node operator's own -upgradenotice=<version>,<mtp>, when <mtp> is exactly the upgrade's activation time. The public fleet runs it with 12.5.9, so its nodes say 12.5.9 |
quorum | The upgrade notice below, when it applies for that same deadline. A single peer never raises it |
So two honest nodes can show different numbers. The rules of Napoleon are followed by every node of 12.5.8 or later; 12.5.9 adds no consensus rule.
The upgrade notice #
Nodes tell each other which release they run (P2P message upgnotice, see P2P integration). When at least 3 network groups of a node's outbound peers, and at least 51% of them, announce the same newer release, the node shows a notice. GET /upgrades/notice gives the whole picture; getupgradenotice over JSON-RPC is the same.
curl -s https://givelotus.org/api/v1/upgrades/notice| Field | Meaning |
|---|---|
own_version | This node's release |
announced | What this node announces: version, required_before, page, from_option |
notice | applies, counted_by (netgroup, or peer after the 5-minute fallback), version, page, required_before, deadline_passed, groups_for, deadline_groups_for, groups_counted, message, since |
rule | quorum_pct (51), min_groups (3), peer_fallback_after_s (300), peer_fallback_active, counted_connections, page_base |
peers | Each peer's announcement and whether it counted |
The notice never downloads or installs anything. The link it shows is built by the node from three integers, as https://lotusia.network/upgrades/<major>.<minor>.<patch>/: no text or URL from the network is ever shown. The route is not cached.
For a program, the useful part is: if notice.applies is true, a newer release is widely run; if required_release_met of /upgrades is false, the node will not follow the chain after the deadline.
