Get Migration ID programmatically?
- WallaceKellyOP
How can I programmatically get the Migration ID from my validator node?
- WallaceKelly 2
The Migration ID is included in the GET response of
/v0/scan-proxy/dsoof the Scan Proxy API:curl --silent \ http://wallet.localhost:2000/api/validator/v0/scan-proxy/dso \ --header 'Authorization: Bearer eyJhbGciOi...' \ | jq --raw-output '.sv_node_states[0].contract.payload.state.synchronizerNodes[0][1].sequencer.migrationId' - mitesh.mistry
Since major upgrades now happen through Logical Synchronizer Upgrades (LSUs) instead of hard migrations, the migration ID won’t change again. On MainNet it’s 4 and will stay 4, so the simplest and most stable approach is to hard-code it.
The value differs by network:
-
MainNet: 4, permanently (MainNet is never reset).
-
DevNet and TestNet: currently 1. It could go back to 0 if those networks are ever reset, but that hasn’t been decided.
-