mirror of
https://github.com/luxfi/node.git
synced 2026-07-27 03:39:39 +00:00
Drop the Avalanche-heritage /ext prefix; /v1 is the single canonical route surface (one way, no backward compat). The node's baseURL is the source of truth; clients, SDKs, CLI, indexer, maker, genesis, netrunner, and the k8s/compose/gateway/explorer configs are updated to match. Co-authored-by: Hanzo Dev <dev@hanzo.ai>
1.5 KiB
1.5 KiB
ProposerVM GetProposedHeight API
Overview
The GetProposedHeight API endpoint returns the P-Chain height that would be proposed for the next block built on the current preferred block.
Endpoint
/v1/bc/<CHAIN_ID>/proposervm
Method
proposervm.getProposedHeight
Parameters
None
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"proposedHeight": 12345
}
}
Where:
proposedHeight(uint64): The P-Chain height that would be used for the next block
Example Usage
cURL
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"proposervm.getProposedHeight",
"params" :{}
}' -H 'content-type:application/json;' http://127.0.0.1:9650/v1/bc/C/proposervm
Response
{
"jsonrpc": "2.0",
"result": {
"proposedHeight": 12345
},
"id": 1
}
Implementation Details
The proposed P-Chain height is calculated as:
proposedHeight = max(currentPChainHeight, parentPChainHeight)
Where:
currentPChainHeightis obtained from the validator stateparentPChainHeightis the P-Chain height of the preferred block
This ensures monotonic increases in P-Chain height across the blockchain.
Use Cases
- Block Building Prediction: Determine the P-Chain height that will be used before building a block
- Validator Set Queries: Know which validator set will be active for the next block
- Network Monitoring: Track P-Chain height synchronization across chains
- Testing & Debugging: Verify P-Chain height selection logic