Skip to main content

Node API - Avalanche P-Chain


API AuthenticationClick to view API Authentication details
API calls require authentication with API key via Authorization request header or URL property. Calls are made to one of the Avalanche P Chain Node API endpoints found in your app's dashboard.

For example: https://avalanche--mainnet--rpc.datahub.figment.io

Here's some boilerplate to get you started.
fetch("https://avalanche--mainnet--rpc.datahub.figment.io/ext/bc/P", {
method: 'POST', // can also be 'GET', 'PUT' or any appropriate method
headers: {
"Authorization" : "<api_key>",
"Content-Type": "application/json" // if method is 'POST'
},
body: JSON.stringify({
// JSON Payload
})
})

Available Methods

platform.addDelegator

Add a delegator to the Primary Network.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"txID": "6pB3MtHUNogeHapZqMUBmx6N38ii3LzytVDrXuMovwKQFTZLs",
"changeAddr": "P-avax103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
},
"id": 1
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • nodeID is the ID of the node to delegate to.
  • startTime is the Unix time when the delegator starts delegating.
  • endTime is the Unix time when the delegator stops delegating (and staked AVAX is returned).
  • stakeAmount is the amount of nAVAX the delegator is staking.
  • rewardAddress is the address the validator reward goes to, if there is one.
  • from are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.
  • username is the user that pays the transaction fee.
  • password is username‘s password.

Response

  • txID is the ID of this transaction.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.

platform.addValidator

Add a validator to the Primary Network.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"txID": "6pb3mthunogehapzqmubmx6n38ii3lzytvdrxumovwkqftzls",
"changeAddr": "P-avax103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
},
"id": 1
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • nodeID is the node ID of the validator being added.
  • startTime is the Unix time when the validator starts validating the Primary Network.
  • endTime is the Unix time when the validator stops validating the Primary Network (and staked AVAX is returned).
  • stakeAmount is the amount of nAVAX the validator is staking.
  • rewardAddress is the address the validator reward will go to, if there is one.
  • delegationFeeRate is the percent fee this validator charges when others delegate stake to them. Up to 4 decimal places allowed; additional decimal places are ignored. Must be between 0 and 100, inclusive. For example, if delegationFeeRate is 1.2345 and someone delegates to this validator, then when the delegation period is over, 1.2345% of the reward goes to the validator and the rest goes to the delegator.
  • from are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.
  • username is the user that pays the transaction fee.
  • password is username‘s password.

Response

  • txID is the ID of this transaction.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.

platform.addSubnetValidator

Add a validator to a Subnet other than the Primary Network. The Validator must validate the Primary Network for the entire duration they validate this Subnet.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"txID": "2exafyvRNSE5ehwjhafBVt6CTntot7DFjsZNcZ54GSxBbVLcCm",
"changeAddr": "P-avax103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
}
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • nodeID is the node ID of the validator being added to the Subnet. This validator must validate the Primary Network for the entire duration that it validates this Subnet.
  • subnetID is the ID of the Subnet we’re adding a validator to.
  • startTime is the unix time when the validator starts validating the Subnet. It must be at or after the time that the validator starts validating the Primary Network
  • endTime is the unix time when the validator stops validating the Subnet. It must be at or before the time that the validator stops validating the Primary Network.
  • weight is the validator’s weight used for sampling. If the validator’s weight is 1 and the cumulative weight of all validators in the Subnet is 100, then this validator will be included in about 1 in every 100 samples during consensus. The cumulative weight of all validators in the Subnet must be at least snow-sample-size. For example, if there is only one validator in the Subnet, its weight must be at least snow-sample-size (default 20). Recall that a validator's weight can't be changed while it is validating, so take care to use an appropriate value.
  • from are the fund addresses that the user wants to use to pay for this operation. If omitted, use any of user's addresses as needed.
  • changeAddr is the address any change/left-over of the fund (specified by the from addresses) will be sent to. If omitted, change/left-over is sent to one of the addresses controlled by the user.
  • username is the user that pays the transaction fee.
  • password is username‘s password.

Response

  • txID is the ID of this transaction.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.

platform.createAddress

Create a new address controlled by the given user.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"address": "P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
},
"id": 1
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • username is the user that pays the transaction fee.
  • password is username‘s password.

Response

  • new address generated controlled by the given user.

platform.createBlockchain

Create a new blockchain. Currently only supports the creation of new instances of the AVM and the Timestamp VM.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"txID": "2TBnyFmST7TirNm6Y6z4863zusRVpWi5Cj1sKS9bXTUmu8GfeU",
"changeAddr": "P-avax103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
},
"id": 1
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • subnetID is the ID of the Subnet that validates the new blockchain. The Subnet must exist and can’t be the Primary Network.
  • vmID is the ID of the Virtual Machine the blockchain runs. Can also be an alias of the Virtual Machine.
  • name is a human-readable name for the new blockchain. Not necessarily unique.
  • genesisData is the byte representation of the genesis state of the new blockchain encoded in the format specified by the encoding parameter.
  • encoding specifies the format to use for genesisData. Can only be hex when a value is provided. Virtual Machines should have a static API method named buildGenesis that can be used to generate genesisData
  • from are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.
  • username is the user that pays the transaction fee. This user must have a sufficient number of the subnet’s control keys.
  • password is username‘s password.

Response

  • txID is the ID of this transaction.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.

platform.createSubnet

Create a new Subnet.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"txID": "hJfC5xGhtjhCGBh1JWn3vZ51KJP696TZrsbadPHNbQG2Ve5yd"
},
"id": 1
}
SpecificationView Specification

The Subnet’s ID is the same as this transaction’s ID.

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • In order to add a validator to this Subnet, threshold signatures are required from the addresses in controlKeys
  • from are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.
  • username is the user that pays the transaction fee.
  • password is username‘s password.

Response

  • txID is the ID of this transaction.

platform.exportAVAX

Send AVAX from an address on the P-Chain to an address on the X-Chain or C-Chain. After issuing this transaction, you must call the X-Chain's avm.import or C-Chain's avax.import with assetID AVAX to complete the transfer.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"txID": "2Kz69TNBSeABuaVjKa6ZJCTLobbe5xo9c5eU8QwdUSvPo2dBk3",
"changeAddr": "P-avax103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
},
"id": 1
}
SpecificationView Specification

Parameters

  • amount is the amount of nAVAX to send.
  • to is the address on the X-Chain or C-Chain to send the AVAX to.
  • from are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.
  • username is the user sending the AVAX and paying the transaction fee.
  • password is username‘s password.

Response

  • txID is the ID of this transaction.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.

platform.exportKey

Get the private key that controls a given address. The returned private key can be added to a user with platform.importKey.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"privateKey": "PrivateKey-Lf49kAJw3CbaL783vmbeAJvhscJqC7vi5yBYLxw2XfbzNS5RS"
}
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • username is the user that controls address.
  • password is username‘s password.
  • address for which you want to get the privateKey.

Response

  • privateKey is the string representation of the private key that controls address.

platform.getBalance

Get the balance of AVAX controlled by a given address.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"balance": "20000000000000000",
"unlocked": "10000000000000000",
"lockedStakeable": "10000000000000000",
"lockedNotStakeable": "0",
"utxoIDs": [
{
"txID": "11111111111111111111111111111111LpoYY",
"outputIndex": 1
},
{
"txID": "11111111111111111111111111111111LpoYY",
"outputIndex": 0
}
]
},
"id": 1
}
SpecificationView Specification

Parameters

  • address is the address to get the balance of.

Response

  • balance is the total balance, in nAVAX.
  • unlocked is the unlocked balance, in nAVAX.
  • lockedStakeable is the locked stakeable balance, in nAVAX.
  • lockedNotStakeable is the locked and not stakeable balance, in nAVAX.
  • utxoIDs are the IDs of the UTXOs that reference address.

platform.getBlock

Get a block by its ID.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"block": "0x00000000000309473dc99a0851a29174d84e522da8ccb1a56ac23f7b0ba79f80acce34cf576900000000000f4241000000010000001200000001000000000000000000000000000000000000000000000000000000000000000000000000000000011c4c57e1bcb3c567f9f03caa75563502d1a21393173c06d9d79ea247b20e24800000000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000050000000338e0465f0000000100000000000000000427d4b22a2a78bcddd456742caf91b56badbff985ee19aef14573e7343fd6520000000121e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000070000000338d1041f0000000000000000000000010000000195a4467dd8f939554ea4e6501c08294386938cbf000000010000000900000001c79711c4b48dcde205b63603efef7c61773a0eb47efb503fcebe40d21962b7c25ebd734057400a12cce9cf99aceec8462923d5d91fffe1cb908372281ed738580119286dde",
"encoding": "hex"
},
"id": 1
}
SpecificationView Specification

Parameters

  • blockID is the block ID. It should be in cb58 format.
  • encoding is the encoding format to use. Can be either hex or json. Defaults to hex.

Response

  • block is the transaction encoded to encoding.
  • encoding is the encoding.

platform.getBlockchains

Get all the blockchains that exist (excluding the P-Chain).

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"blockchains": [
{
"id": "2jRZvKtXY5nyWTqRwFh1KMHGrCRxJoULu4r2CsayWRnjdDGbV1",
"name": "StepNetwork",
"subnetID": "7f9jciLEX25NPJEaAz1X7XF44B1Q9UBwq6PdnCHm5mnUq1e1C",
"vmID": "dkjnKTbCTozMmvJJETzrz8sYVs7vSKzkGShHoa493UcQEweU6"
},
{
"id": "2VDqgWTD4wBw3mrs6TVpQpXKgJfiEc8RS7tdyigtWqgB9PDHDU",
"name": "StepNetwork",
"subnetID": "ubYm3dgKcQqioeJimTH5YCRDuR1BBMaoaefEt1pywjJnUFvqJ",
"vmID": "dkjnKTbCTozMmvJJETzrz8sYVs7vSKzkGShHoa493UcQEweU6"
}
]
},
"id": 1
}
SpecificationView Specification

Parameters

  • None

Response

  • blockchains is all of the blockchains that exists on the Avalanche network.
  • name is the human-readable name of this blockchain.
  • id is the blockchain’s ID.
  • subnetID is the ID of the Subnet that validates this blockchain.
  • vmID is the ID of the Virtual Machine the blockchain runs.

platform.getBlockchainStatus

Get the status of a blockchain.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"status": "Unknown"
},
"id": 1
}
SpecificationView Specification

Parameters

  • blockchainID ID of the blockchain to check the status for.

Response

  • status is one of:
  • Validating: The blockchain is being validated by this node.
  • Created: The blockchain exists but isn’t being validated by this node.
  • Preferred: The blockchain was proposed to be created and is likely to be created but the transaction isn’t yet accepted.
  • Syncing: This node is participating in this blockchain as a non-validating node.
  • Unknown: The blockchain either wasn’t proposed or the proposal to create it isn’t preferred. The proposal may be resubmitted.

platform.getCurrentSupply

Returns an upper bound on the number of AVAX that exist. This is an upper bound because it does not account for burnt tokens, including transaction fees.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"supply": "411043063936396639"
},
"id": 1
}
SpecificationView Specification

Parameters

  • None

Response

  • supply is an upper bound on the number of AVAX that exist, denominated in nAVAX.

platform.getCurrentValidators

List the current validators of the given Subnet.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"validators": [
{
"txID": "2NNkpYTGfTFLSGXJcHtVv6drwVU2cczhmjK2uhvwDyxwsjzZMm",
"startTime": "1600368632",
"endTime": "1602960455",
"stakeAmount": "2000000000000",
"nodeID": "NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD",
"rewardOwner": {
"locktime": "0",
"threshold": "1",
"addresses": [
"P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
]
},
"potentialReward": "117431493426",
"delegationFee": "10.0000",
"uptime": "0.0000",
"connected": false,
"delegators": [
{
"txID": "Bbai8nzGVcyn2VmeYcbS74zfjJLjDacGNVuzuvAQkHn1uWfoV",
"startTime": "1600368523",
"endTime": "1602960342",
"stakeAmount": "25000000000",
"nodeID": "NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD",
"rewardOwner": {
"locktime": "0",
"threshold": "1",
"addresses": [
"P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
]
},
"potentialReward": "11743144774"
}
]
}
]
},
"id": 1
}
SpecificationView Specification

Parameters

  • subnetID is the Subnet whose current validators are returned. If omitted, returns the current validators of the Primary Network (optional).
  • nodeIDs is a list of the nodeIDs of current validators to request. If omitted, all current validators are returned. If a specified nodeID is not in the set of current validators, it will not be included in the response (optional).

Response

  • validators:
    • txID is the validator transaction.
    • startTime is the Unix time when the validator starts validating the Subnet.
    • endTime is the Unix time when the validator stops validating the Subnet.
    • stakeAmount is the amount of nAVAX this validator staked. Omitted if subnetID is not the Primary Network.
    • nodeID is the validator’s node ID.
    • weight is the validator’s weight when sampling validators. Omitted if subnetID is the Primary Network.
    • rewardOwner is an OutputOwners output which includes locktime, threshold and array of addresses. Omitted if subnetID is not the Primary Network.
    • potentialReward is the potential reward earned from staking. Omitted if subnetID is not the Primary Network.
    • delegationFeeRate is the percent fee this validator charges when others delegate stake to them. Omitted if subnetID is not the Primary Network.
    • uptime is the % of time the queried node has reported the peer as online. Omitted if subnetID is not the Primary Network.
    • connected is if the node is connected and tracks the Subnet.
    • delegators is the list of delegators to this validator. Omitted if subnetID is not the Primary Network.
      • txID is the delegator transaction.
      • startTime is the Unix time when the delegator started.
      • endTime is the Unix time when the delegator stops.
      • stakeAmount is the amount of nAVAX this delegator staked.
      • nodeID is the validating node’s node ID.
      • rewardOwner is an OutputOwners output which includes locktime, threshold and array of addresses.
      • potentialReward is the potential reward earned from staking

platform.getHeight

Returns the height of the last accepted block.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"height": "2067046"
},
"id": 1
}
SpecificationView Specification

Parameters

  • None

Response

  • height of the last accepted block.

platform.getMaxStakeAmount

Returns the maximum amount of nAVAX staking to the named node during a particular time period.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"amount": "2000000000000000"
},
"id": 1
}
SpecificationView Specification

Parameters

  • subnetID is a Buffer or cb58 string representing Subnet
  • nodeID is a string representing ID of the node whose stake amount is required during the given duration
  • startTime is a big number denoting start time of the duration during which stake amount of the node is required.
  • endTime is a big number denoting end time of the duration during which stake amount of the node is required.

Response

  • amount the maximum amount of nAVAX staking to the named node.

platform.getMinStake

Get the minimum amount of AVAX required to validate the Primary Network and the minimum amount of AVAX that can be delegated.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"minValidatorStake": "2000000000000",
"minDelegatorStake": "25000000000"
},
"id": 1
}
SpecificationView Specification

Parameters

  • None

Response

  • minValidatorStake - The minimum amount of AVAX required to validate the Primary Network.
  • minDelegatorStake - The minimum amount of AVAX that can be delegated.

platform.getPendingValidators

List the validators in the pending validator set of the specified Subnet. Each validator is not currently validating the Subnet but will in the future.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"validators": [],
"delegators": [
{
"txID": "28tK2Tb753BoHJHJE5V5sidvWn89hL8ieqVY8GQVgwqMs3M3PF",
"startTime": "1661241300",
"endTime": "1663056242",
"stakeAmount": "28092568333",
"nodeID": "NodeID-LwXHkWth4f244zZ4j5wu5fZmrYDzJ6bda"
},
{
"txID": "zEWCeMqZpxytLgfSzshz1hgpqdgc44Zx51D6XjMWjTjqL3kok",
"startTime": "1661241424",
"endTime": "1673791227",
"stakeAmount": "38444331970",
"nodeID": "NodeID-DXaXYKoAHmysSuzPC2c91LzwPku6XYfmZ"
}
]
},
"id": 1
}
SpecificationView Specification

Parameters

  • subnetID is the Subnet whose current validators are returned. If omitted, returns the current validators of the Primary Network (optional).
  • nodeIDs is a list of the nodeIDs of pending validators to request. If omitted, all pending validators are returned. If a specified nodeID is not in the set of pending validators, it will not be included in the response (optional).

Response

  • validators:
    • txID is the validator transaction.
    • startTime is the Unix time when the validator starts validating the Subnet.
    • endTime is the Unix time when the validator stops validating the Subnet.
    • stakeAmount is the amount of nAVAX this validator staked. Omitted if subnetID is not the Primary Network.
    • nodeID is the validator’s node ID.
    • connected if the node is connected and tracks the Subnet.
    • weight is the validator’s weight when sampling validators. Omitted if subnetID is the Primary Network.
  • delegators:
    • txID is the delegator transaction.
    • startTime is the Unix time when the delegator starts.
    • endTime is the Unix time when the delegator stops.
    • stakeAmount is the amount of nAVAX this delegator staked. Omitted if subnetID is not the Primary Network.
    • nodeID is the validating node’s node ID.

platform.getRewardUTXOs

Returns the UTXOs that were rewarded after the provided transaction's staking or delegation period ended.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"numFetched": "2",
"utxos": [
"0x0000a195046108a85e60f7a864bb567745a37f50c6af282103e47cc62f036cee404700000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c1f01765",
"0x0000ae8b1b94444eed8de9a81b1222f00f1b4133330add23d8ac288bffa98b85271100000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216473d042a"
],
"encoding": "hex"
},
"id": 1
}
SpecificationView Specification

Parameters

  • txID is the ID of the staking or delegating transaction.
  • encoding specifies the format for the returned UTXOs. Can only be hex when a value is provided (optional).

Response

  • numFetched is the number of returned UTXOs
  • utxos is an array of encoded reward UTXOs
  • encoding specifies the format for the returned UTXOs. Can only be hex when a value is provided.

platform.getStakingAssetID

Retrieve an assetID for a subnet’s staking asset. Currently, this only returns the Primary Network’s staking assetID.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z"
},
"id": 1
}
SpecificationView Specification

Parameters

  • subnetID is the Subnet whose assetID is requested (optional).

Response

  • assetID is the assetID for a subnet’s staking asset.

platform.getSubnets

Get info about the Subnets.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"subnets": [
{
"id": "hW8Ma7dLMA7o4xmJf3AXBbo17bXzE7xnThUd3ypM4VAWo1sNJ",
"controlKeys": [
"KNjXsaA1sZsaKCD1cd85YXauDuxshTes2",
"Aiz4eEt5xv9t4NCnAWaQJFNz5ABqLtJkR"
],
"threshold": "2"
}
]
},
"id": 1
}
SpecificationView Specification

Parameters

  • ids are the IDs of the Subnets to get information about. If omitted, gets information about all Subnets.

Response

  • id is the Subnet’s ID.
  • threshold signatures from addresses in controlKeys are needed to add a validator to the Subnet.

platform.getStake

Get the amount of nAVAX staked by a set of addresses. The amount returned does not include staking rewards.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"staked": "26870333254",
"stakedOutputs": [
"0x000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff00000007000000064198bf46000000000000000000000001000000010ed1bea258fca42e094ccc625698eab5f7e01d190f0f332d"
],
"encoding": "hex"
},
"id": 1
}
SpecificationView Specification

Parameters

  • addresses are the addresses to get information about.

Response

  • staked is the amount of nAVAX staked by addresses provided.
  • stakedOutputs are the string representation of staked outputs.
  • encoding specifies the format for the returned outputs.

platform.getTimestamp

Get the current P-Chain timestamp.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"timestamp": "2022-08-23T08:11:29Z"
},
"id": 1
}
SpecificationView Specification

Parameters

  • None

Response

  • timestamp current P-Chain timestamp.

platform.getTotalStake

Get the total amount of nAVAX staked on the Primary Network.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"stake": "264473785564041383"
},
"id": 1
}
SpecificationView Specification

Parameters

  • subnetID (optional)

Response

  • stake - The total amount of nAVAX staked on the Primary Network

platform.getTx

Gets a transaction by its ID.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"tx": {
"unsignedTx": {
"networkID": 1,
"blockchainID": "11111111111111111111111111111111LpoYY",
"outputs": [],
"inputs": [
{
"txID": "2BhkKSwqubHMsYqVBQvwtgHWczVUc4jPacZ1zaTGLZSpWgC9L5",
"outputIndex": 0,
"assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
"input": {
"amount": 8649063,
"signatureIndices": [
0
]
}
},
{
"txID": "2BhkKSwqubHMsYqVBQvwtgHWczVUc4jPacZ1zaTGLZSpWgC9L5",
"outputIndex": 1,
"assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
"input": {
"amount": 89990000000,
"signatureIndices": [
0
]
}
},
{
"txID": "2BhkKSwqubHMsYqVBQvwtgHWczVUc4jPacZ1zaTGLZSpWgC9L5",
"outputIndex": 2,
"assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
"input": {
"amount": 257218557,
"signatureIndices": [
0
]
}
}
],
"memo": "0x456e6e6f57616c6c6574204176616c616e636865204578706f7274",
"SyntacticallyVerified": true,
"destinationChain": "2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5",
"exportedOutputs": [
{
"assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
"output": {
"addresses": [
"P-avax19fhg5vqwusqsphq85puwqsulmsvsvsct28scl3"
],
"amount": 90254867620,
"locktime": 0,
"threshold": 1
}
}
]
},
"credentials": [
{
"signatures": [
"0x47c7347f1d7b77f59a3fa0a4c257db3974c2e0fee67bcd6e54584a0835167afe630d3a2208853584ea2877da2d382b2db03f697fcf1f9982b03b761c3ed68c6600"
]
},
{
"signatures": [
"0x47c7347f1d7b77f59a3fa0a4c257db3974c2e0fee67bcd6e54584a0835167afe630d3a2208853584ea2877da2d382b2db03f697fcf1f9982b03b761c3ed68c6600"
]
},
{
"signatures": [
"0x47c7347f1d7b77f59a3fa0a4c257db3974c2e0fee67bcd6e54584a0835167afe630d3a2208853584ea2877da2d382b2db03f697fcf1f9982b03b761c3ed68c6600"
]
}
]
},
"encoding": "json"
},
"id": 1
}
SpecificationView Specification

Parameters

  • txID is the ID of the transaction.
  • Optional encoding parameter to specify the format for the returned transaction. Can be either "hex" or "json". Defaults to "hex".

Response

  • tx - Transaction details for the given transaction ID.
  • encoding - parameter to specify the format for the returned transaction. Can be either "hex" or "json".

platform.getTxStatus

Gets a transaction’s status by its ID. If the transaction was dropped, response will include a reason field with more information why the transaction was dropped.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"status": "Committed"
},
"id": 1
}
SpecificationView Specification

Parameters

  • txID is the ID of the transaction.

Response

  • status is one of:
  • Committed: The transaction is (or will be) accepted by every node
  • Processing: The transaction is being voted on by this node
  • Dropped: The transaction will never be accepted by any node in the network, check reason field for more information
  • Unknown: The transaction hasn’t been seen by this node

platform.getUTXOs

Gets the UTXOs that reference a given set of addresses.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"numFetched": "0",
"utxos": [],
"endIndex": {
"address": "P-avax1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6",
"utxo": "11111111111111111111111111111111LpoYY"
},
"encoding": "hex"
},
"id": 1
}
SpecificationView Specification

Parameters

  • addresses given set of addresses to get the the UTXOs
  • limit At most limit UTXOs are returned. If limit is omitted or greater than 1024, it is set to 1024.
  • startIndex - If startIndex is omitted, will fetch all UTXOs up to limit.
  • encoding specifies the format for the returned UTXOs. Can only be hex when a value is provided.

Response

  • utxos is a list of UTXOs such that each UTXO references at least one address in addresses.
  • At most limit UTXOs are returned. If limit is omitted or greater than 1024, it is set to 1024.
  • This method supports pagination. endIndex denotes the last UTXO returned. To get the next set of UTXOs, use the value of endIndex as startIndex in the next call.
  • If startIndex is omitted, will fetch all UTXOs up to limit.
  • When using pagination (ie when startIndex is provided), UTXOs are not guaranteed to be unique across multiple calls. That is, a UTXO may appear in the result of the first call, and then again in the second call.
  • When using pagination, consistency is not guaranteed across multiple calls. That is, the UTXO set of the addresses may have changed between calls.
  • encoding specifies the format for the returned UTXOs. Can only be hex when a value is provided.

platform.getValidatorsAt

Get the validators and their weights of a Subnet or the Primary Network at a given P-Chain height.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"validators": {
"NodeID-12dyQ7nhRzsNSiFzEoW1RWK819Zkssf5g": 5735539268404,
"NodeID-13e5BTpgRh2WBWKB3uSZeSoLgKtNUhunG": 29592498533559,
"NodeID-14B6jvGvZaaXUrTPMuTxHdWLG4EDvBPxy": 2124342115020,
"NodeID-15hq3yMVXeHiTULyPVNcsGbgiPyBKu2wd": 2025000000000,
"NodeID-168kTGVaSDD9CsPQzbqMpQg6zUvKatqr6": 35550838989367
}
},
"id": 1
}
SpecificationView Specification

Parameters

  • height is the P-Chain height to get the validator set at.
  • subnetID is the Subnet ID to get the validator set of. If not given, gets validator set of the Primary Network.

Response

  • validators - The validators and their weights.

platform.importAVAX

Complete a transfer of AVAX from the X-Chain, or C-Chain to the P-Chain.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"txID": "P63NjowXaQJXt5cmspqdoD3VcuQdXUPM5eoZE2Vcg63aVEx8R",
"changeAddr": "P-avax103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
},
"id": 1
}
SpecificationView Specification

Before this method is called, you must call the X-Chain’s avm.export or C-Chain’s avax.export method with assetID AVAX to initiate the transfer.

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • to is the ID of the address the AVAX is imported to. This must be the same as the to argument in the corresponding call to the X-Chain’s or C-Chain's export.
  • sourceChain is the chain the funds are coming from. Must be either "X" or "C".
  • from are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.
  • username is the user that controls from and change addresses.
  • password is username‘s password.

Response

  • txID ID of this transaction.
  • changeAddr is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.

platform.importKey

Give a user control over an address by providing the private key that controls the address.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"address": "P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
}
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • username
  • password
  • Add privateKey to username‘s set of private keys.

Response

  • address is the address username now controls with the private key.

platform.issueTx

Issue a transaction to the Platform Chain.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"txID": "G3BuH6ytQ2averrLxJJugjWZHTRubzCrUZEXoheG5JMqL5ccY"
},
"id": 1
}
SpecificationView Specification

Parameters

  • tx is the byte representation of a transaction.
  • encoding specifies the encoding format for the transaction bytes. Can only be hex when a value is provided.

Response

  • txID is the transaction’s ID.

platform.listAddresses

List addresses controlled by the given user

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"addresses": [
"P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
]
},
"id": 1
}
SpecificationView Specification

Not recommended for use on Mainnet. See warning notice in Keystore API.

Parameters

  • username
  • password

Response

  • addresses - Addresses controlled by the given user

platform.sampleValidators

Sample validators from the specified Subnet.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"validators": [
"NodeID-Le5rVEBBPdgYEcEJpvYeKo36hRs75WE5S",
"NodeID-PD54wi24ENhbBnKKhoD68MGXCDc3A3iA8"
]
},
"id": 1
}
SpecificationView Specification

Parameters

  • size is the number of validators to sample.
  • subnetID is the Subnet to sampled from. If omitted, defaults to the Primary Network.

Response

  • validators Each element of validators is the ID of a validator.

platform.validatedBy

Get the Subnet that validates a given blockchain.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"subnetID": "7f9jciLEX25NPJEaAz1X7XF44B1Q9UBwq6PdnCHm5mnUq1e1C"
},
"id": 1
}
SpecificationView Specification

Parameters

  • blockchainID is the blockchain’s ID.

Response

  • subnetID is the ID of the Subnet that validates the blockchain.

platform.validates

Get the IDs of the blockchains a Subnet validates.

Request Body (try it)
Example Response
{
"jsonrpc": "2.0",
"result": {
"blockchainIDs": [
"2jRZvKtXY5nyWTqRwFh1KMHGrCRxJoULu4r2CsayWRnjdDGbV1"
]
},
"id": 1
}
SpecificationView Specification

Parameters

  • subnetID is the Subnet’s ID.

Response

  • Each element of blockchainIDs is the ID of a blockchain the Subnet validates.