Home

Method Chain API

This API allows clients to interact with Dijets Method Chain, which acts as a metadata chain maintaining Dijet's Validators set and handles the creation of other blockchains.

Endpoint#


_10
/ext/bc/P

Format#

This API uses the json 2.0 RPC format.

Methods#

addDelegator#

Add a delegator to the Primary Network.

A delegator stakes DJT and specifies a validator (the delegatee) to validate on their behalf. The delegatee has an increased probability of being sampled by other validators (weight) in proportion to the stake delegated to them.

The delegatee charges a fee to the delegator; the former receives a percentage of the delegator’s validation reward (if any.) A transaction that delegates stake has no fee.

The delegation period must be a subset of the period that the delegatee validates the Primary Network.

Signature:


_17
platform.addDelegator(
_17
{
_17
nodeID: string,
_17
startTime: int,
_17
endTime: int,
_17
stakeAmount: int,
_17
rewardAddress: string,
_17
from: []string, // optional
_17
changeAddr: string, // optional
_17
username: string,
_17
password: string
_17
}
_17
) ->
_17
{
_17
txID: string,
_17
changeAddr: string
_17
}

  • nodeID is the DijetsNode 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 DJT is returned).
  • stakeAmount is the amount of nDJT 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.
  • txID is the transaction ID

Example Call:


_16
curl -X POST --data '{
_16
"jsonrpc": "2.0",
_16
"method": "platform.addDelegator",
_16
"params": {
_16
"nodeID":"DijetsNode-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ",
_16
"rewardAddress":"P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_16
"startTime":1594102400,
_16
"endTime":1604102400,
_16
"stakeAmount":100000,
_16
"from": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_16
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u",
_16
"username":"PenXenOleFren",
_16
"password":"myPassword"
_16
},
_16
"id": 1
_16
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"txID": "6pB3MtHUNogeHapZqMUBmx6N38ii3LzytVDrXuMovwKQFTZLs",
_10
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
_10
},
_10
"id": 1
_10
}

method.addSubnetValidator#

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

Signature:


_17
platform.addSubnetValidator(
_17
{
_17
nodeID: string,
_17
subnetID: string,
_17
startTime: int,
_17
endTime: int,
_17
weight: int,
_17
from: []string, // optional
_17
changeAddr: string, // optional
_17
username: string,
_17
password: string
_17
}
_17
) ->
_17
{
_17
txID: string,
_17
changeAddr: string,
_17
}

  • nodeID is the node ID of the validator being added to the Subnetwork. This validator must validate the Primary Network for the entire duration that it validates this Subnetwork.
  • subnetID is the ID of the Subnetwork we’re adding a validator to.
  • startTime is the Unix time when the validator starts validating the Subnetwork. 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 Subnetwork. 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 Subnetwork 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 Subnetwork must be at least min-sample-size. For example, if there is only one validator in the Subnetwork, its weight must be at least min-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.
  • txID is the transaction ID.

Example Call:


_16
curl -X POST --data '{
_16
"jsonrpc": "2.0",
_16
"method": "platform.addSubnetValidator",
_16
"params": {
_16
"nodeID":"DijetsNode-7xhw2mdxuds44j42tcb6u5579esbst3lg",
_16
"subnetID":"zbfoww1ffkpvrfywpj1cvqrfnyesepdfc61hmu2n9jnghduel",
_16
"startTime":1583524047,
_16
"endTime":1604102399,
_16
"weight":1,
_16
"from": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_16
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u",
_16
"username":"PenXenOleFren",
_16
"password":"myPassword"
_16
},
_16
"id": 1
_16
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {
_10
"txID": "2exafyvRNSE5ehwjhafBVt6CTntot7DFjsZNcZ54GSxBbVLcCm",
_10
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
_10
}
_10
}

method.addValidator#

Add a validator to the Primary Network. You must stake DJT to do this. If the node is sufficiently correct and responsive while validating, you receive a reward when end of staking period is reached. The validator’s probability of being sampled by other validators during consensus is in proportion to the amount of DJT staked.

The validator charges a fee to delegators; the former receives a percentage of the delegator’s validation reward (if any.) The minimum delegation fee is 2%. A transaction that adds a validator has no fee.

The validation period must be between 2 weeks and 1 year for the Mainnet, and 24 hours and 1 year for Dijets TestNet Testnet.

There is a maximum total weight imposed on validators. This means that no validator will ever have more DJT staked and delegated to it than this value. This value will initially be set to min(5 * amount staked, 3M DJT). The total value on a validator is 3 million DJT.

Signature:


_18
platform.addValidator(
_18
{
_18
nodeID: string,
_18
startTime: int,
_18
endTime: int,
_18
stakeAmount: int,
_18
rewardAddress: string,
_18
delegationFeeRate: float,
_18
from: []string, // optional
_18
changeAddr: string, // optional
_18
username: string,
_18
password: string
_18
}
_18
) ->
_18
{
_18
txID: string,
_18
changeAddr: string
_18
}

  • 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 DJT is returned).
  • stakeAmount is the amount of nDJT 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.
  • txID is the transaction ID

Example Call:

In this example, we use shell command date to compute Unix times 10 minutes and 2 days in the future. (Note: If you’re on a Mac, replace $(date with $(gdate. If you don’t have gdate installed, do brew install coreutils.)


_17
curl -X POST --data '{
_17
"jsonrpc": "2.0",
_17
"method": "platform.addValidator",
_17
"params": {
_17
"nodeID":"DijetsNode-ARCLrphAHZ28xZEBfUL7SVAmzkTZNe1LK",
_17
"rewardAddress":"P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_17
"from": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_17
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u",
_17
"startTime":'$(date --date="10 minutes" +%s)',
_17
"endTime":'$(date --date="2 days" +%s)',
_17
"stakeAmount":1000000,
_17
"delegationFeeRate":10,
_17
"username":"PenXenOleFren",
_17
"password":"myPassword"
_17
},
_17
"id": 1
_17
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"txID": "6pb3mthunogehapzqmubmx6n38ii3lzytvdrxumovwkqftzls",
_10
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
_10
},
_10
"id": 1
_10
}

method.createAddress#

Create a new address controlled by the given user.

Signature:


_10
platform.createAddress({
_10
username: string,
_10
password: string
_10
}) -> {address: string}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.createAddress",
_10
"params": {
_10
"username":"PenXenOleFren",
_10
"password":"myPassword"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"address": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
_10
},
_10
"id": 1
_10
}

method.createBlockchain#

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

Signature:


_17
platform.createBlockchain(
_17
{
_17
subnetID: string,
_17
vmID: string,
_17
name: string,
_17
genesisData: string,
_17
encoding: string, // optional
_17
from: []string, // optional
_17
changeAddr: string, // optional
_17
username: string,
_17
password: string
_17
}
_17
) ->
_17
{
_17
txID: string,
_17
changeAddr: string
_17
}

  • subnetID is the ID of the Subnetwork that validates the new blockchain. The Subnetwork 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 Subnetwork's control keys.
  • password is username‘s password.
  • txID is the transaction ID.

Example Call:

In this example we’re creating a new instance of the Timestamp Virtual Machine. genesisData came from calling timestamp.buildGenesis.


_16
curl -X POST --data '{
_16
"jsonrpc": "2.0",
_16
"method": "platform.createBlockchain",
_16
"params" : {
_16
"vmID":"timestamp",
_16
"subnetID":"2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r",
_16
"name":"My new timestamp",
_16
"genesisData": "0x07000000000000000000000000000000000000000000000000000000000000000016943a",
_16
"encoding": "hex",
_16
"from": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_16
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u",
_16
"username":"PenXenOleFren",
_16
"password":"myPassword"
_16
},
_16
"id": 1
_16
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"txID": "2TBnyFmST7TirNm6Y6z4863zusRVpWi5Cj1sKS9bXTUmu8GfeU",
_10
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
_10
},
_10
"id": 1
_10
}

method.createSubnet#

Create a new Subnetwork.

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

Signature:


_14
platform.createSubnet(
_14
{
_14
controlKeys: []string,
_14
threshold: int,
_14
from: []string, // optional
_14
changeAddr: string, // optional
_14
username: string,
_14
password: string
_14
}
_14
) ->
_14
{
_14
txID: string,
_14
changeAddr: string
_14
}

  • In order to add a validator to this Subnetwork, 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.

Example Call:


_16
curl -X POST --data '{
_16
"jsonrpc": "2.0",
_16
"method": "platform.createSubnet",
_16
"params": {
_16
"controlKeys":[
_16
"P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_16
"P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
_16
],
_16
"threshold":2,
_16
"from": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_16
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u",
_16
"username":"PenXenOleFren",
_16
"password":"myPassword"
_16
},
_16
"id": 1
_16
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"txID": "hJfC5xGhtjhCGBh1JWn3vZ51KJP696TZrsbadPHNbQG2Ve5yd"
_10
},
_10
"id": 1
_10
}

method.exportDJT#

Send DJT from an address on the Method Chain to an address on the Value Chain or Utility Chain. After issuing this transaction, you must call the Value Chain's avm.import or Utility Chain's djtx.import with assetID DJT to complete the transfer.

Signature:


_14
platform.exportDJT(
_14
{
_14
amount: int,
_14
from: []string, // optional
_14
to: string,
_14
changeAddr: string, // optional
_14
username: string,
_14
password: string
_14
}
_14
) ->
_14
{
_14
txID: string,
_14
changeAddr: string
_14
}

  • amount is the amount of nDJT to send.
  • to is the address on the Value Chain or Utility Chain to send the DJT 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 DJT and paying the transaction fee.
  • password is username‘s password.
  • txID is the ID of this transaction.

Example Call:


_13
curl -X POST --data '{
_13
"jsonrpc": "2.0",
_13
"method": "platform.exportDJT",
_13
"params": {
_13
"to":"X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_13
"amount":1,
_13
"from": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_13
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u",
_13
"username":"PenXenOleFren",
_13
"password":"myPassword"
_13
},
_13
"id": 1
_13
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"txID": "2Kz69TNBSeABuaVjKa6ZJCTLobbe5xo9c5eU8QwdUSvPo2dBk3",
_10
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
_10
},
_10
"id": 1
_10
}

method.exportKey#

Get the private key that controls a given address. The returned private key can be added to a user with [method.importKey](Method Chain.md#platformimportkey).

Signature:


_10
platform.exportKey({
_10
username: string,
_10
password: string,
_10
address: string
_10
}) -> {privateKey: string}

  • username is the user that controls address.
  • password is username‘s password.
  • privateKey is the string representation of the private key that controls address.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"platform.exportKey",
_10
"params" :{
_10
"username" :"PenXenOleFren",
_10
"password": "myPassword",
_10
"address": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {
_10
"privateKey": "PrivateKey-Lf49kAJw3CbaL783vmbeAJvhscJqC7vi5yBYLxw2XfbzNS5RS"
_10
}
_10
}

method.getBalance#

Get the balance of DJT controlled by a given address.

Signature:


_12
platform.getBalance({
_12
addresses: []string
_12
}) -> {
_12
balances: string -> int,
_12
unlockeds: string -> int,
_12
lockedStakeables: string -> int,
_12
lockedNotStakeables: string -> int,
_12
utxoIDs: []{
_12
txID: string,
_12
outputIndex: int
_12
}
_12
}

  • addresses are the addresses to get the balance of.
  • balances is a map from assetID to the total balance.
  • unlockeds is a map from assetID to the unlocked balance.
  • lockedStakeables is a map from assetID to the locked stakeable balance.
  • lockedNotStakeables is a map from assetID to the locked and not stakeable balance.
  • utxoIDs are the IDs of the UTXOs that reference address.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" : 1,
_10
"method" :"platform.getBalance",
_10
"params" :{
_10
"addresses":["P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p"]
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_30
{
_30
"jsonrpc": "2.0",
_30
"result": {
_30
"balance": "30000000000000000",
_30
"unlocked": "20000000000000000",
_30
"lockedStakeable": "10000000000000000",
_30
"lockedNotStakeable": "0",
_30
"balances": {
_30
"BUuypiq2wyuLMvyhzFXcPyxPMCgSp7eeDohhQRqTChoBjKziC": "30000000000000000"
_30
},
_30
"unlockeds": {
_30
"BUuypiq2wyuLMvyhzFXcPyxPMCgSp7eeDohhQRqTChoBjKziC": "20000000000000000"
_30
},
_30
"lockedStakeables": {
_30
"BUuypiq2wyuLMvyhzFXcPyxPMCgSp7eeDohhQRqTChoBjKziC": "10000000000000000"
_30
},
_30
"lockedNotStakeables": {},
_30
"utxoIDs": [
_30
{
_30
"txID": "11111111111111111111111111111111LpoYY",
_30
"outputIndex": 1
_30
},
_30
{
_30
"txID": "11111111111111111111111111111111LpoYY",
_30
"outputIndex": 0
_30
}
_30
]
_30
},
_30
"id": 1
_30
}

method.getBlock#

Get a block by its ID.

Signature:


_10
platform.getBlock({
_10
blockID: string
_10
encoding: string // optional
_10
}) -> {
_10
block: string,
_10
encoding: string
_10
}

Request:

  • 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.

Hex Example

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getBlock",
_10
"params": {
_10
"blockID": "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG",
_10
"encoding": "hex"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"block": "0x00000000000309473dc99a0851a29174d84e522da8ccb1a56ac23f7b0ba79f80acce34cf576900000000000f4241000000010000001200000001000000000000000000000000000000000000000000000000000000000000000000000000000000011c4c57e1bcb3c567f9f03caa75563502d1a21393173c06d9d79ea247b20e24800000000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000050000000338e0465f0000000100000000000000000427d4b22a2a78bcddd456742caf91b56badbff985ee19aef14573e7343fd6520000000121e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000070000000338d1041f0000000000000000000000010000000195a4467dd8f939554ea4e6501c08294386938cbf000000010000000900000001c79711c4b48dcde205b63603efef7c61773a0eb47efb503fcebe40d21962b7c25ebd734057400a12cce9cf99aceec8462923d5d91fffe1cb908372281ed738580119286dde",
_10
"encoding": "hex"
_10
},
_10
"id": 1
_10
}

JSON Example

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getBlock",
_10
"params": {
_10
"blockID": "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG",
_10
"encoding": "json"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_57
{
_57
"jsonrpc": "2.0",
_57
"result": {
_57
"block": {
_57
"parentID": "5615di9ytxujackzaXNrVuWQy5y8Yrt8chPCscMr5Ku9YxJ1S",
_57
"height": 1000001,
_57
"txs": [
_57
{
_57
"unsignedTx": {
_57
"inputs": {
_57
"networkID": 1,
_57
"blockchainID": "11111111111111111111111111111111LpoYY",
_57
"outputs": [],
_57
"inputs": [
_57
{
_57
"txID": "DTqiagiMFdqbNQ62V2Gt1GddTVLkKUk2caGr4pyza9hTtsfta",
_57
"outputIndex": 0,
_57
"assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
_57
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
_57
"input": {
_57
"amount": 13839124063,
_57
"signatureIndices": [0]
_57
}
_57
}
_57
],
_57
"memo": "0x"
_57
},
_57
"destinationChain": "2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5",
_57
"exportedOutputs": [
_57
{
_57
"assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
_57
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
_57
"output": {
_57
"addresses": [
_57
"P-dijets1jkjyvlwclyu42n4yuegpczpfgwrf8r9lyj0d3c"
_57
],
_57
"amount": 13838124063,
_57
"locktime": 0,
_57
"threshold": 1
_57
}
_57
}
_57
]
_57
},
_57
"credentials": [
_57
{
_57
"signatures": [
_57
"0xc79711c4b48dcde205b63603efef7c61773a0eb47efb503fcebe40d21962b7c25ebd734057400a12cce9cf99aceec8462923d5d91fffe1cb908372281ed7385801"
_57
]
_57
}
_57
]
_57
}
_57
]
_57
},
_57
"encoding": "json"
_57
},
_57
"id": 1
_57
}

method.getBlockchains#

Get all the blockchains that exist (excluding the Method Chain).

Signature:


_10
platform.getBlockchains() ->
_10
{
_10
blockchains: []{
_10
id: string,
_10
name:string,
_10
subnetID: string,
_10
vmID: string
_10
}
_10
}

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

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getBlockchains",
_10
"params": {},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_50
{
_50
"jsonrpc": "2.0",
_50
"result": {
_50
"blockchains": [
_50
{
_50
"id": "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM",
_50
"name": "Value Chain",
_50
"subnetID": "11111111111111111111111111111111LpoYY",
_50
"vmID": "jvYyfQTxGMJLuGWa55kdP2p2zSUYsQ5Raupu4TW34ZAUBAbtq"
_50
},
_50
{
_50
"id": "2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5",
_50
"name": "Utility Chain",
_50
"subnetID": "11111111111111111111111111111111LpoYY",
_50
"vmID": "mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6"
_50
},
_50
{
_50
"id": "CqhF97NNugqYLiGaQJ2xckfmkEr8uNeGG5TQbyGcgnZ5ahQwa",
_50
"name": "Simple DAG Payments",
_50
"subnetID": "11111111111111111111111111111111LpoYY",
_50
"vmID": "sqjdyTKUSrQs1YmKDTUbdUhdstSdtRTGRbUn8sqK8B6pkZkz1"
_50
},
_50
{
_50
"id": "VcqKNBJsYanhVFxGyQE5CyNVYxL3ZFD7cnKptKWeVikJKQkjv",
_50
"name": "Simple Chain Payments",
_50
"subnetID": "11111111111111111111111111111111LpoYY",
_50
"vmID": "sqjchUjzDqDfBPGjfQq2tXW1UCwZTyvzAWHsNzF2cb1eVHt6w"
_50
},
_50
{
_50
"id": "2SMYrx4Dj6QqCEA3WjnUTYEFSnpqVTwyV3GPNgQqQZbBbFgoJX",
_50
"name": "Simple Timestamp Server",
_50
"subnetID": "11111111111111111111111111111111LpoYY",
_50
"vmID": "tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH"
_50
},
_50
{
_50
"id": "KDYHHKjM4yTJTT8H8qPs5KXzE6gQH5TZrmP1qVr1P6qECj3XN",
_50
"name": "My new timestamp",
_50
"subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r",
_50
"vmID": "tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH"
_50
},
_50
{
_50
"id": "2TtHFqEAAJ6b33dromYMqfgavGPF3iCpdG3hwNMiart2aB5QHi",
_50
"name": "My new AVM",
_50
"subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r",
_50
"vmID": "jvYyfQTxGMJLuGWa55kdP2p2zSUYsQ5Raupu4TW34ZAUBAbtq"
_50
}
_50
]
_50
},
_50
"id": 1
_50
}

method.getBlockchainStatus#

Get the status of a blockchain.

Signature:


_10
platform.getBlockchainStatus(
_10
{
_10
blockchainID: string
_10
}
_10
) -> {status: string}

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.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getBlockchainStatus",
_10
"params":{
_10
"blockchainID":"2NbS4dwGaf2p1MaXb65PrkZdXRwmSX4ZzGnUu7jm3aykgThuZE"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"status": "Created"
_10
},
_10
"id": 1
_10
}

method.getCurrentSupply#

Returns an upper bound on amount of tokens that exist that can stake the requested Subnetwork. This is an upper bound because it does not account for burnt tokens, including transaction fees.

Signature:


_10
platform.getCurrentSupply({
_10
subnetID: string // optional
_10
}) -> {supply: int}

  • supply is an upper bound on the number of tokens that exist.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getCurrentSupply",
_10
"params": {
_10
"subnetID": "11111111111111111111111111111111LpoYY"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"supply": "365865167637779183"
_10
},
_10
"id": 1
_10
}

The response in this example indicates that DJT’s supply is at most 365.865 million.

method.getCurrentValidators#

List the current validators of the given Subnetwork.

Signature:


_44
platform.getCurrentValidators({
_44
subnetID: string, // optional
_44
nodeIDs: string[], // optional
_44
}) -> {
_44
validators: []{
_44
txID: string,
_44
startTime: string,
_44
endTime: string,
_44
stakeAmount: string,
_44
nodeID: string,
_44
weight: string,
_44
validationRewardOwner: {
_44
locktime: string,
_44
threshold: string,
_44
addresses: string[]
_44
},
_44
delegationRewardOwner: {
_44
locktime: string,
_44
threshold: string,
_44
addresses: string[]
_44
},
_44
potentialReward: string,
_44
delegationFee: string,
_44
uptime: string,
_44
connected: bool,
_44
signer: {
_44
publicKey: string,
_44
proofOfPosession: string
_44
},
_44
delegators: []{
_44
txID: string,
_44
startTime: string,
_44
endTime: string,
_44
stakeAmount: string,
_44
nodeID: string,
_44
rewardOwner: {
_44
locktime: string,
_44
threshold: string,
_44
addresses: string[]
_44
},
_44
potentialReward: string,
_44
}
_44
}
_44
}

  • subnetID is the Subnetwork whose current validators are returned. If omitted, returns the current validators of the Primary Network.
  • 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.
  • validators:
    • txID is the validator transaction.
    • startTime is the Unix time when the validator starts validating the Subnetwork.
    • endTime is the Unix time when the validator stops validating the Subnetwork.
    • stakeAmount is the amount of tokens this validator staked. Omitted if subnetID is not a PoS Subnetwork.
    • nodeID is the validator’s node ID.
    • weight is the validator’s weight when sampling validators. Omitted if subnetID is a PoS Subnetwork.
    • validationRewardOwner is an OutputOwners output which includes locktime, threshold and array of addresses. Specifies the owner of the potential reward earned from staking. Omitted if subnetID is not a PoS Subnetwork.
    • delegationRewardOwner is an OutputOwners output which includes locktime, threshold and array of addresses. Specifies the owner of the potential reward earned from delegations. Omitted if subnetID is not a PoS Subnetwork.
    • potentialReward is the potential reward earned from staking. Omitted if subnetID is not a PoS Subnetwork.
    • delegationFeeRate is the percent fee this validator charges when others delegate stake to them. Omitted if subnetID is not a PoS Subnetwork.
    • uptime is the % of time the queried node has reported the peer as online and validating the Subnetwork.
    • connected is if the node is connected and tracks the Subnetwork.
    • signer is the node's BLS public key and proof of possession. Omitted if the validator doesn't have a BLS public key.
    • delegators is the list of delegators to this validator. Omitted if subnetID is not a PoS Subnetwork.
      • 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 nDJT 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

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getCurrentValidators",
_10
"params": {},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_44
{
_44
"jsonrpc": "2.0",
_44
"result": {
_44
"validators": [
_44
{
_44
"txID": "2NNkpYTGfTFLSGXJcHtVv6drwVU2cczhmjK2uhvwDyxwsjzZMm",
_44
"startTime": "1600368632",
_44
"endTime": "1602960455",
_44
"stakeAmount": "2000000000000",
_44
"nodeID": "DijetsNode-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD",
_44
"validationRewardOwner": {
_44
"locktime": "0",
_44
"threshold": "1",
_44
"addresses": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"]
_44
},
_44
"delegationRewardOwner": {
_44
"locktime": "0",
_44
"threshold": "1",
_44
"addresses": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"]
_44
},
_44
"potentialReward": "117431493426",
_44
"delegationFee": "10.0000",
_44
"uptime": "0.0000",
_44
"connected": false,
_44
"delegators": [
_44
{
_44
"txID": "Bbai8nzGVcyn2VmeYcbS74zfjJLjDacGNVuzuvAQkHn1uWfoV",
_44
"startTime": "1600368523",
_44
"endTime": "1602960342",
_44
"stakeAmount": "25000000000",
_44
"nodeID": "DijetsNode-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD",
_44
"rewardOwner": {
_44
"locktime": "0",
_44
"threshold": "1",
_44
"addresses": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"]
_44
},
_44
"potentialReward": "11743144774"
_44
}
_44
]
_44
}
_44
]
_44
},
_44
"id": 1
_44
}

method.getHeight#

Returns the height of the last accepted block.

Signature:


_10
platform.getHeight() ->
_10
{
_10
height: int,
_10
}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getHeight",
_10
"params": {},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"height": "56"
_10
},
_10
"id": 1
_10
}

method.getMaxStakeAmount#

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

Signature:


_11
platform.getMaxStakeAmount(
_11
{
_11
subnetID: string,
_11
nodeID: string,
_11
startTime: int,
_11
endTime: int
_11
}
_11
) ->
_11
{
_11
amount: uint64
_11
}

  • subnetID is a Buffer or cb58 string representing Subnetwork
  • 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.

Example Call:


_11
curl -X POST --data '{
_11
"jsonrpc": "2.0",
_11
"method": "platform.getMaxStakeAmount",
_11
"params": {
_11
"subnetID":"11111111111111111111111111111111LpoYY",
_11
"nodeID":"DijetsNode-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg",
_11
"startTime": 1644240334,
_11
"endTime": 1644240634
_11
},
_11
"id": 1
_11
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"amount": "2000000000000000"
_10
},
_10
"id": 1
_10
}

method.getMinStake#

Get the minimum amount of tokens required to validate the requested Subnetwork and the minimum amount of tokens that can be delegated.

Signature:


_10
platform.getMinStake({
_10
subnetID: string // optional
_10
}) ->
_10
{
_10
minValidatorStake : uint64,
_10
minDelegatorStake : uint64
_10
}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"platform.getMinStake",
_10
"params": {
_10
"subnetID":"11111111111111111111111111111111LpoYY"
_10
},
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"minValidatorStake": "2000000000000",
_10
"minDelegatorStake": "25000000000"
_10
},
_10
"id": 1
_10
}

method.getPendingValidators#

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

Signature:


_26
platform.getPendingValidators({
_26
subnetID: string, // optional
_26
nodeIDs: string[], // optional
_26
}) -> {
_26
validators: []{
_26
txID: string,
_26
startTime: string,
_26
endTime: string,
_26
stakeAmount: string,
_26
nodeID: string,
_26
delegationFee: string,
_26
connected: bool,
_26
signer: {
_26
publicKey: string,
_26
proofOfPosession: string
_26
},
_26
weight: string,
_26
},
_26
delegators: []{
_26
txID: string,
_26
startTime: string,
_26
endTime: string,
_26
stakeAmount: string,
_26
nodeID: string
_26
}
_26
}

  • subnetID is the Subnetwork whose current validators are returned. If omitted, returns the current validators of the Primary Network.
  • 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.
  • validators:
    • txID is the validator transaction.
    • startTime is the Unix time when the validator starts validating the Subnetwork.
    • endTime is the Unix time when the validator stops validating the Subnetwork.
    • stakeAmount is the amount of tokens this validator staked. Omitted if subnetID is not a PoS Subnetwork.
    • nodeID is the validator’s node ID.
    • connected if the node is connected and tracks the Subnetwork.
    • signer is the node's BLS public key and proof of possession. Omitted if the validator doesn't have a BLS public key.
    • weight is the validator’s weight when sampling validators. Omitted if subnetID is a PoS Subnetwork.
  • 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 tokens this delegator staked.
    • nodeID is the validating node’s node ID.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getPendingValidators",
_10
"params": {},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_26
{
_26
"jsonrpc": "2.0",
_26
"result": {
_26
"validators": [
_26
{
_26
"txID": "2NNkpYTGfTFLSGXJcHtVv6drwVU2cczhmjK2uhvwDyxwsjzZMm",
_26
"startTime": "1600368632",
_26
"endTime": "1602960455",
_26
"stakeAmount": "200000000000",
_26
"nodeID": "DijetsNode-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD",
_26
"delegationFee": "10.0000",
_26
"connected": false
_26
}
_26
],
_26
"delegators": [
_26
{
_26
"txID": "Bbai8nzGVcyn2VmeYcbS74zfjJLjDacGNVuzuvAQkHn1uWfoV",
_26
"startTime": "1600368523",
_26
"endTime": "1602960342",
_26
"stakeAmount": "20000000000",
_26
"nodeID": "DijetsNode-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg"
_26
}
_26
]
_26
},
_26
"id": 1
_26
}

method.getRewardUTXOs#

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

Signature:


_10
platform.getRewardUTXOs({
_10
txID: string,
_10
encoding: string // optional
_10
}) -> {
_10
numFetched: integer,
_10
utxos: []string,
_10
encoding: string
_10
}

  • txID is the ID of the staking or delegating transaction
  • 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.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getRewardUTXOs",
_10
"params": {
_10
"txID": "2nmH8LithVbdjaXsxVQCQfXtzN9hBbmebrsaEYnLM9T32Uy2Y5"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_12
{
_12
"jsonrpc": "2.0",
_12
"result": {
_12
"numFetched": "2",
_12
"utxos": [
_12
"0x0000a195046108a85e60f7a864bb567745a37f50c6af282103e47cc62f036cee404700000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c1f01765",
_12
"0x0000ae8b1b94444eed8de9a81b1222f00f1b4133330add23d8ac288bffa98b85271100000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216473d042a"
_12
],
_12
"encoding": "hex"
_12
},
_12
"id": 1
_12
}

method.getStake#

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

Signature:


_10
platform.getStake({
_10
addresses: []string
_10
}) ->
_10
{
_10
stakeds: string -> int,
_10
stakedOutputs: []string,
_10
encoding: string
_10
}

  • addresses are the addresses to get information about.
  • stakeds is a map from assetID to the amount staked by addresses provided.
  • stakedOutputs are the string representation of staked outputs.
  • encoding specifies the format for the returned outputs.

Example Call:


_11
curl -X POST --data '{
_11
"jsonrpc": "2.0",
_11
"method": "platform.getStake",
_11
"params": {
_11
"addresses": [
_11
"P-dijets1pmgmagjcljjzuz2ve339dx82khm7q8getlegte"
_11
]
_11
},
_11
"id": 1
_11
}
_11
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_13
{
_13
"jsonrpc": "2.0",
_13
"result": {
_13
"stakeds": {
_13
"FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z": "25000000000"
_13
},
_13
"stakedOutputs": [
_13
"0x000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff00000007000000064198bf46000000000000000000000001000000010ed1bea258fca42e094ccc625698eab5f7e01d190f0f332d"
_13
],
_13
"encoding": "hex"
_13
},
_13
"id": 1
_13
}

method.getStakingAssetID#

Retrieve an assetID for a Subnetwork’s staking asset.

Signature:


_10
platform.getStakingAssetID({
_10
subnetID: string // optional
_10
}) -> {
_10
assetID: string
_10
}

  • subnetID is the Subnetwork whose assetID is requested.
  • assetID is the assetID for a Subnetwork’s staking asset.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getStakingAssetID",
_10
"params": {
_10
"subnetID": "11111111111111111111111111111111LpoYY"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"assetID": "2fombhL7aGPwj3KH4bfrmJwW6PVnMobf9Y2fn9GwxiAAJyFDbe"
_10
},
_10
"id": 1
_10
}

method.getSubnetworks#

Get info about the Subnetworks.

Signature:


_10
platform.getSubnetworks({
_10
ids: []string
_10
}) ->
_10
{
_10
Subnetworks: []{
_10
id: string,
_10
controlKeys: []string,
_10
threshold: string
_10
}
_10
}

  • ids are the IDs of the Subnetworks to get information about. If omitted, gets information about all Subnetworks.
  • id is the Subnet’s ID.
  • threshold signatures from addresses in controlKeys are needed to add a validator to the Subnetwork. If the Subnetwork is a PoS Subnetwork, then threshold will be 0 and controlKeys will be empty.

See here for information on adding a validator to a Subnetwork.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getSubnetworks",
_10
"params": {"ids":["hW8Ma7dLMA7o4xmJf3AXBbo17bXzE7xnThUd3ypM4VAWo1sNJ"]},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_16
{
_16
"jsonrpc": "2.0",
_16
"result": {
_16
"Subnetworks": [
_16
{
_16
"id": "hW8Ma7dLMA7o4xmJf3AXBbo17bXzE7xnThUd3ypM4VAWo1sNJ",
_16
"controlKeys": [
_16
"KNjXsaA1sZsaKCD1cd85YXauDuxshTes2",
_16
"Aiz4eEt5xv9t4NCnAWaQJFNz5ABqLtJkR"
_16
],
_16
"threshold": "2"
_16
}
_16
]
_16
},
_16
"id": 1
_16
}

method.getTimestamp#

Get the current Method Chain timestamp.

Signature:


_10
platform.getTimestamp() -> {time: string}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getTimestamp",
_10
"params": {},
_10
"id": 1
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"timestamp": "2021-09-07T00:00:00-04:00"
_10
},
_10
"id": 1
_10
}

method.getTotalStake#

Get the total amount of tokens staked on the requested Subnetwork.

Signature:


_10
platform.getTotalStake({
_10
subnetID: string
_10
}) -> {
_10
stake: int
_10
weight: int
_10
}

Primary Network Example

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getTotalStake",
_10
"params": {
_10
"subnetID": "11111111111111111111111111111111LpoYY"
_10
},
_10
"id": 1
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"stake": "279825917679866811",
_10
"weight": "279825917679866811"
_10
},
_10
"id": 1
_10
}

Subnetwork Example

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getTotalStake",
_10
"params": {
_10
"subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r",
_10
},
_10
"id": 1
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"weight": "100000"
_10
},
_10
"id": 1
_10
}

method.getTx#

Gets a transaction by its ID.

Optional encoding parameter to specify the format for the returned transaction. Can be either hex or json. Defaults to hex.

Signature:


_10
platform.getTx({
_10
txID: string,
_10
encoding: string // optional
_10
}) -> {
_10
tx: string,
_10
encoding: string,
_10
}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getTx",
_10
"params": {
_10
"txID":"2Eug3Y6j1yD745y5bQ9bFCf5nvU2qT1eB53GSpD15EkGUfu8xh",
_10
"encoding": "json"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_49
{
_49
"jsonrpc": "2.0",
_49
"result": {
_49
"tx": {
_49
"unsignedTx": {
_49
"inputs": {
_49
"networkID": 5,
_49
"blockchainID": "11111111111111111111111111111111LpoYY",
_49
"outputs": [],
_49
"inputs": [
_49
{
_49
"txID": "2QYG5yR6YW55ixmBvR4zXLCZKV9we9bmSWHHiGppF4Ko17bTPn",
_49
"outputIndex": 0,
_49
"assetID": "U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK",
_49
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
_49
"input": {
_49
"amount": 1998000000,
_49
"signatureIndices": [0]
_49
}
_49
}
_49
],
_49
"memo": "0x"
_49
},
_49
"destinationChain": "yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp",
_49
"exportedOutputs": [
_49
{
_49
"assetID": "U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK",
_49
"fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
_49
"output": {
_49
"addresses": ["P-test1yhem6kev6gkfsyse3m5z09e6qsuxujz0arpw8v"],
_49
"amount": 1997000000,
_49
"locktime": 0,
_49
"threshold": 1
_49
}
_49
}
_49
]
_49
},
_49
"credentials": [
_49
{
_49
"signatures": [
_49
"0xdbc03ebd7d06927baacf7aea85cdebd7e0b95cf5b57715a09981fd5a75dac2cb610636bf3657ba4ca47dad4beed2e7f0ec692e7f12f1bbc9f3c34fc5c18ae35d01"
_49
]
_49
}
_49
]
_49
},
_49
"encoding": "json"
_49
},
_49
"id": 1
_49
}

method.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.

Signature:


_10
platform.getTxStatus({
_10
txID: string
_10
}) -> {status: string}

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

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getTxStatus",
_10
"params": {
_10
"txID":"TAG9Ns1sa723mZy1GSoGqWipK6Mvpaj7CAswVJGM6MkVJDF9Q"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"status": "Committed"
_10
},
_10
"id": 1
_10
}

method.getUTXOs#

Gets the UTXOs that reference a given set of addresses.

Signature:


_21
platform.getUTXOs(
_21
{
_21
addresses: []string,
_21
limit: int, // optional
_21
startIndex: { // optional
_21
address: string,
_21
utxo: string
_21
},
_21
sourceChain: string, // optional
_21
encoding: string, // optional
_21
},
_21
) ->
_21
{
_21
numFetched: int,
_21
utxos: []string,
_21
endIndex: {
_21
address: string,
_21
utxo: string
_21
},
_21
encoding: string,
_21
}

  • 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 (that is 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.

Example

Suppose we want all UTXOs that reference at least one of P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5 and P-dijets1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6.


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"platform.getUTXOs",
_10
"params" :{
_10
"addresses":["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", "P-dijets1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6"],
_10
"limit":5,
_10
"encoding": "hex"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

This gives response:


_19
{
_19
"jsonrpc": "2.0",
_19
"result": {
_19
"numFetched": "5",
_19
"utxos": [
_19
"0x0000a195046108a85e60f7a864bb567745a37f50c6af282103e47cc62f036cee404700000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c1f01765",
_19
"0x0000ae8b1b94444eed8de9a81b1222f00f1b4133330add23d8ac288bffa98b85271100000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216473d042a",
_19
"0x0000731ce04b1feefa9f4291d869adc30a33463f315491e164d89be7d6d2d7890cfc00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21600dd3047",
_19
"0x0000b462030cc4734f24c0bc224cf0d16ee452ea6b67615517caffead123ab4fbf1500000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c71b387e",
_19
"0x000054f6826c39bc957c0c6d44b70f961a994898999179cc32d21eb09c1908d7167b00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f2166290e79d"
_19
],
_19
"endIndex": {
_19
"address": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_19
"utxo": "kbUThAUfmBXUmRgTpgD6r3nLj7rJUGho6xyht5nouNNypH45j"
_19
},
_19
"encoding": "hex"
_19
},
_19
"id": 1
_19
}

Since numFetched is the same as limit, we can tell that there may be more UTXOs that were not fetched. We call the method again, this time with startIndex:


_14
curl -X POST --data '{
_14
"jsonrpc":"2.0",
_14
"id" :1,
_14
"method" :"platform.getUTXOs",
_14
"params" :{
_14
"addresses":["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_14
"limit":5,
_14
"startIndex": {
_14
"address": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_14
"utxo": "0x62fc816bb209857923770c286192ab1f9e3f11e4a7d4ba0943111c3bbfeb9e4a5ea72fae"
_14
},
_14
"encoding": "hex"
_14
}
_14
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

This gives response:


_18
{
_18
"jsonrpc": "2.0",
_18
"result": {
_18
"numFetched": "4",
_18
"utxos": [
_18
"0x000020e182dd51ee4dcd31909fddd75bb3438d9431f8e4efce86a88a684f5c7fa09300000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21662861d59",
_18
"0x0000a71ba36c475c18eb65dc90f6e85c4fd4a462d51c5de3ac2cbddf47db4d99284e00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21665f6f83f",
_18
"0x0000925424f61cb13e0fbdecc66e1270de68de9667b85baa3fdc84741d048daa69fa00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216afecf76a",
_18
"0x000082f30327514f819da6009fad92b5dba24d27db01e29ad7541aa8e6b6b554615c00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216779c2d59"
_18
],
_18
"endIndex": {
_18
"address": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_18
"utxo": "21jG2RfqyHUUgkTLe2tUp6ETGLriSDTW3th8JXFbPRNiSZ11jK"
_18
},
_18
"encoding": "hex"
_18
},
_18
"id": 1
_18
}

Since numFetched is less than limit, we know that we are done fetching UTXOs and don’t need to call this method again.

Suppose we want to fetch the UTXOs exported from the Value Chain to the Method Chain in order to build an ImportTx. Then we need to call GetUTXOs with the sourceChain argument in order to retrieve the atomic UTXOs:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"platform.getUTXOs",
_10
"params" :{
_10
"addresses":["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_10
"sourceChain": "X",
_10
"encoding": "hex"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

This gives response:


_15
{
_15
"jsonrpc": "2.0",
_15
"result": {
_15
"numFetched": "1",
_15
"utxos": [
_15
"0x00001f989ffaf18a18a59bdfbf209342aa61c6a62a67e8639d02bb3c8ddab315c6fa0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000000746a528800000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29cd704fe76"
_15
],
_15
"endIndex": {
_15
"address": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_15
"utxo": "S5UKgWoVpoGFyxfisebmmRf8WqC7ZwcmYwS7XaDVZqoaFcCwK"
_15
},
_15
"encoding": "hex"
_15
},
_15
"id": 1
_15
}

method.getValidatorsAt#

Get the validators and their weights of a Subnetwork or the Primary Network at a given Method Chain height.

Signature:


_10
platform.getValidatorsAt(
_10
{
_10
height: int,
_10
subnetID: string, // optional
_10
}
_10
)

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

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.getValidatorsAt",
_10
"params": {
_10
"height":1
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_13
{
_13
"jsonrpc": "2.0",
_13
"result": {
_13
"validators": {
_13
"DijetsNode-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg": 2000000000000000,
_13
"DijetsNode-GWPcbFJZFfZreETSoWjPimr846mXEKCtu": 2000000000000000,
_13
"DijetsNode-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ": 2000000000000000,
_13
"DijetsNode-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN": 2000000000000000,
_13
"DijetsNode-P7oB2McjBGgW2NXXWVYjV8JEDFoW9xDE5": 2000000000000000
_13
}
_13
},
_13
"id": 1
_13
}

method.importDJT#

Complete a transfer of DJT from the Value Chain, or Utility Chain to the Method Chain.

Before this method is called, you must call the Value Chain’s avm.export or Utility Chain’s djtx.export method with assetID DJT to initiate the transfer.

Signature:


_14
platform.importDJT(
_14
{
_14
to: string,
_14
sourceChain: string,
_14
from: []string, // optional
_14
changeAddr: string, // optional
_14
username: string,
_14
password: string
_14
}
_14
) ->
_14
{
_14
tx: string,
_14
changeAddr: string
_14
}

  • to is the ID of the address the DJT is imported to. This must be the same as the to argument in the corresponding call to the Value Chain’s or Utility 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.

Example Call:


_12
curl -X POST --data '{
_12
"jsonrpc": "2.0",
_12
"method": "platform.importDJT",
_12
"params": {
_12
"to": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
_12
"from": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
_12
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u",
_12
"username": "PenXenOleFren",
_12
"password": "myPassword"
_12
},
_12
"id": 1
_12
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"txID": "P63NjowXaQJXt5cmspqdoD3VcuQdXUPM5eoZE2Vcg63aVEx8R",
_10
"changeAddr": "P-dijets103y30cxeulkjfe3kwfnpt432ylmnxux8r73r8u"
_10
},
_10
"id": 1
_10
}

method.importKey#

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

Signature:


_10
platform.importKey({
_10
username: string,
_10
password: string,
_10
privateKey:string
_10
}) -> {address: string}

  • Add privateKey to username‘s set of private keys. address is the address username now controls with the private key.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"platform.importKey",
_10
"params" :{
_10
"username": "PenXenOleFren",
_10
"password": "myPassword",
_10
"privateKey": "PrivateKey-2w4XiXxPfQK4TypYqnohRL8DRNTz9cGiGmwQ1zmgEqD9c9KWLq"
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {
_10
"address": "P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
_10
}
_10
}

method.issueTx#

Issue a transaction to the Method Chain.

Signature:


_10
platform.issueTx({
_10
tx: string,
_10
encoding: string, // optional
_10
}) -> {txID: string}

  • 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.
  • txID is the transaction’s ID.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.issueTx",
_10
"params": {
_10
"tx":"0x00000009de31b4d8b22991d51aa6aa1fc733f23a851a8c9400000000000186a0000000005f041280000000005f9ca900000030390000000000000001fceda8f90fcb5d30614b99d79fc4baa29307762668f16eb0259a57c2d3b78c875c86ec2045792d4df2d926c40f829196e0bb97ee697af71f5b0a966dabff749634c8b729855e937715b0e44303fd1014daedc752006011b730",
_10
"encoding": "hex"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"txID": "G3BuH6ytQ2averrLxJJugjWZHTRubzCrUZEXoheG5JMqL5ccY"
_10
},
_10
"id": 1
_10
}

method.listAddresses#

List addresses controlled by the given user.

Signature:


_10
platform.listAddresses({
_10
username: string,
_10
password: string
_10
}) -> {addresses: []string}

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.listAddresses",
_10
"params": {
_10
"username":"PenXenOleFren",
_10
"password":"myPassword"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"addresses": ["P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"]
_10
},
_10
"id": 1
_10
}

method.sampleValidators#

Sample validators from the specified Subnetwork.

Signature:


_10
platform.sampleValidators(
_10
{
_10
size: int,
_10
subnetID: string, // optional
_10
}
_10
) ->
_10
{
_10
validators: []string
_10
}

  • size is the number of validators to sample.
  • subnetID is the Subnetwork to sampled from. If omitted, defaults to the Primary Network.
  • Each element of validators is the ID of a validator.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"platform.sampleValidators",
_10
"params" :{
_10
"size":2
_10
}
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"id": 1,
_10
"result": {
_10
"validators": [
_10
"DijetsNode-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ",
_10
"DijetsNode-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN"
_10
]
_10
}
_10
}

method.validatedBy#

Get the Subnetwork that validates a given blockchain.

Signature:


_10
platform.validatedBy(
_10
{
_10
blockchainID: string
_10
}
_10
) -> {subnetID: string}

  • blockchainID is the blockchain’s ID.
  • subnetID is the ID of the Subnetwork that validates the blockchain.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.validatedBy",
_10
"params": {
_10
"blockchainID": "KDYHHKjM4yTJTT8H8qPs5KXzE6gQH5TZrmP1qVr1P6qECj3XN"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r"
_10
},
_10
"id": 1
_10
}

method.validates#

Get the IDs of the blockchains a Subnetwork validates.

Signature:


_10
platform.validates(
_10
{
_10
subnetID: string
_10
}
_10
) -> {blockchainIDs: []string}

  • subnetID is the Subnet’s ID.
  • Each element of blockchainIDs is the ID of a blockchain the Subnetwork validates.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc": "2.0",
_10
"method": "platform.validates",
_10
"params": {
_10
"subnetID":"2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r"
_10
},
_10
"id": 1
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P

Example Response:


_10
{
_10
"jsonrpc": "2.0",
_10
"result": {
_10
"blockchainIDs": [
_10
"KDYHHKjM4yTJTT8H8qPs5KXzE6gQH5TZrmP1qVr1P6qECj3XN",
_10
"2TtHFqEAAJ6b33dromYMqfgavGPF3iCpdG3hwNMiart2aB5QHi"
_10
]
_10
},
_10
"id": 1
_10
}