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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
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.
Once you issue the transaction to add a node as a delegator, there is no way to change the parameters. You can’t remove a stake early or change the stake amount, node ID, or reward address. Please make sure you’re using the correct values. If you’re not sure, please reach out to us on Qowalts
Signature:
_17platform.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}
nodeIDis the DijetsNode ID of the node to delegate to.startTimeis the Unix time when the delegator starts delegating.endTimeis the Unix time when the delegator stops delegating (and staked DJT is returned).stakeAmountis the amount of nDJT the delegator is staking.rewardAddressis the address the validator reward goes to, if there is one.fromare the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddris the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.usernameis the user that pays the transaction fee.passwordisusername‘s password.txIDis the transaction ID
Example Call:
_16curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
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:
_17platform.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}
nodeIDis 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.subnetIDis the ID of the Subnetwork we’re adding a validator to.startTimeis 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 NetworkendTimeis 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.weightis 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 leastmin-sample-size. For example, if there is only one validator in the Subnetwork, its weight must be at leastmin-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.fromare the fund addresses that the user wants to use to pay for this operation. If omitted, use any of user's addresses as needed.changeAddris the address any change/left-over of the fund (specified by thefromaddresses) will be sent to. If omitted, change/left-over is sent to one of the addresses controlled by the user.usernameis the user that pays the transaction fee.passwordisusername‘s password.txIDis the transaction ID.
Example Call:
_16curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
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.
Note that once you issue the transaction to add a node as a validator, there is no way to change the parameters. You can’t remove stake early or change the stake amount, node ID, or reward address. Please make sure you’re using the correct values. If you’re not sure, please reach out to us on Qowalts
Signature:
_18platform.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}
nodeIDis the node ID of the validator being added.startTimeis the Unix time when the validator starts validating the Primary Network.endTimeis the Unix time when the validator stops validating the Primary Network (and staked DJT is returned).stakeAmountis the amount of nDJT the validator is staking.rewardAddressis the address the validator reward will go to, if there is one.delegationFeeRateis 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, ifdelegationFeeRateis1.2345and 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.fromare the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddris the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.usernameis the user that pays the transaction fee.passwordisusername‘s password.txIDis 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.)
_17curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Create a new address controlled by the given user.
Signature:
_10platform.createAddress({_10 username: string,_10 password: string_10}) -> {address: string}
Example Call:
_10curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Create a new blockchain. Currently only supports the creation of new instances of the AVM and the Timestamp VM.
Signature:
_17platform.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}
subnetIDis the ID of the Subnetwork that validates the new blockchain. The Subnetwork must exist and can’t be the Primary Network.vmIDis the ID of the Virtual Machine the blockchain runs. Can also be an alias of the Virtual Machine.nameis a human-readable name for the new blockchain. Not necessarily unique.genesisDatais the byte representation of the genesis state of the new blockchain encoded in the format specified by theencodingparameter.encodingspecifies the format to use forgenesisData. Can only behexwhen a value is provided. Virtual Machines should have a static API method namedbuildGenesisthat can be used to generategenesisDatafromare the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddris the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.usernameis the user that pays the transaction fee. This user must have a sufficient number of the Subnetwork's control keys.passwordisusername‘s password.txIDis 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.
_16curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Create a new Subnetwork.
The Subnetwork’s ID is the same as this transaction’s ID.
Signature:
_14platform.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,
thresholdsignatures are required from the addresses incontrolKeys fromare the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddris the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.usernameis the user that pays the transaction fee.passwordisusername‘s password.
Example Call:
_16curl -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:
_14platform.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}
amountis the amount of nDJT to send.tois the address on the Value Chain or Utility Chain to send the DJT to.fromare the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddris the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.usernameis the user sending the DJT and paying the transaction fee.passwordisusername‘s password.txIDis the ID of this transaction.
Example Call:
_13curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
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:
_10platform.exportKey({_10 username: string,_10 password: string,_10 address: string_10}) -> {privateKey: string}
usernameis the user that controlsaddress.passwordisusername‘s password.privateKeyis the string representation of the private key that controlsaddress.
Example Call:
_10curl -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:
_12platform.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}
addressesare the addresses to get the balance of.balancesis a map from assetID to the total balance.unlockedsis a map from assetID to the unlocked balance.lockedStakeablesis a map from assetID to the locked stakeable balance.lockedNotStakeablesis a map from assetID to the locked and not stakeable balance.utxoIDsare the IDs of the UTXOs that referenceaddress.
Example Call:
_10curl -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:
_10platform.getBlock({_10 blockID: string_10 encoding: string // optional_10}) -> {_10 block: string,_10 encoding: string_10}
Request:
blockIDis the block ID. It should be in cb58 format.encodingis the encoding format to use. Can be eitherhexorjson. Defaults tohex.
Response:
blockis the transaction encoded toencoding.encodingis theencoding.
Hex Example
Example Call:
_10curl -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:
_10curl -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:
_10platform.getBlockchains() ->_10{_10 blockchains: []{_10 id: string,_10 name:string,_10 subnetID: string,_10 vmID: string_10 }_10}
blockchainsis all of the blockchains that exists on the Dijets network.nameis the human-readable name of this blockchain.idis the blockchain’s ID.subnetIDis the ID of the Subnetwork that validates this blockchain.vmIDis the ID of the Virtual Machine the blockchain runs.
Example Call:
_10curl -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:
_10platform.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:
_10curl -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:
_10platform.getCurrentSupply({_10 subnetID: string // optional_10}) -> {supply: int}
supplyis an upper bound on the number of tokens that exist.
Example Call:
_10curl -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:
_44platform.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}
subnetIDis the Subnetwork whose current validators are returned. If omitted, returns the current validators of the Primary Network.nodeIDsis 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:txIDis the validator transaction.startTimeis the Unix time when the validator starts validating the Subnetwork.endTimeis the Unix time when the validator stops validating the Subnetwork.stakeAmountis the amount of tokens this validator staked. Omitted ifsubnetIDis not a PoS Subnetwork.nodeIDis the validator’s node ID.weightis the validator’s weight when sampling validators. Omitted ifsubnetIDis a PoS Subnetwork.validationRewardOwneris anOutputOwnersoutput which includeslocktime,thresholdand array ofaddresses. Specifies the owner of the potential reward earned from staking. Omitted ifsubnetIDis not a PoS Subnetwork.delegationRewardOwneris anOutputOwnersoutput which includeslocktime,thresholdand array ofaddresses. Specifies the owner of the potential reward earned from delegations. Omitted ifsubnetIDis not a PoS Subnetwork.potentialRewardis the potential reward earned from staking. Omitted ifsubnetIDis not a PoS Subnetwork.delegationFeeRateis the percent fee this validator charges when others delegate stake to them. Omitted ifsubnetIDis not a PoS Subnetwork.uptimeis the % of time the queried node has reported the peer as online and validating the Subnetwork.connectedis if the node is connected and tracks the Subnetwork.signeris the node's BLS public key and proof of possession. Omitted if the validator doesn't have a BLS public key.delegatorsis the list of delegators to this validator. Omitted ifsubnetIDis not a PoS Subnetwork.txIDis the delegator transaction.startTimeis the Unix time when the delegator started.endTimeis the Unix time when the delegator stops.stakeAmountis the amount of nDJT this delegator staked.nodeIDis the validating node’s node ID.rewardOwneris anOutputOwnersoutput which includeslocktime,thresholdand array ofaddresses.potentialRewardis the potential reward earned from staking
Example Call:
_10curl -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:
_10platform.getHeight() ->_10{_10 height: int,_10}
Example Call:
_10curl -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:
_11platform.getMaxStakeAmount(_11 {_11 subnetID: string,_11 nodeID: string,_11 startTime: int,_11 endTime: int_11 }_11) ->_11{_11 amount: uint64_11}
subnetIDis a Buffer or cb58 string representing SubnetworknodeIDis a string representing ID of the node whose stake amount is required during the given durationstartTimeis a big number denoting start time of the duration during which stake amount of the node is required.endTimeis a big number denoting end time of the duration during which stake amount of the node is required.
Example Call:
_11curl -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:
_10platform.getMinStake({_10 subnetID: string // optional_10}) ->_10{_10 minValidatorStake : uint64,_10 minDelegatorStake : uint64_10}
Example Call:
_10curl -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:
_26platform.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}
subnetIDis the Subnetwork whose current validators are returned. If omitted, returns the current validators of the Primary Network.nodeIDsis 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:txIDis the validator transaction.startTimeis the Unix time when the validator starts validating the Subnetwork.endTimeis the Unix time when the validator stops validating the Subnetwork.stakeAmountis the amount of tokens this validator staked. Omitted ifsubnetIDis not a PoS Subnetwork.nodeIDis the validator’s node ID.connectedif the node is connected and tracks the Subnetwork.signeris the node's BLS public key and proof of possession. Omitted if the validator doesn't have a BLS public key.weightis the validator’s weight when sampling validators. Omitted ifsubnetIDis a PoS Subnetwork.
delegators:txIDis the delegator transaction.startTimeis the Unix time when the delegator starts.endTimeis the Unix time when the delegator stops.stakeAmountis the amount of tokens this delegator staked.nodeIDis the validating node’s node ID.
Example Call:
_10curl -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:
_10platform.getRewardUTXOs({_10 txID: string,_10 encoding: string // optional_10}) -> {_10 numFetched: integer,_10 utxos: []string,_10 encoding: string_10}
txIDis the ID of the staking or delegating transactionnumFetchedis the number of returned UTXOsutxosis an array of encoded reward UTXOsencodingspecifies the format for the returned UTXOs. Can only behexwhen a value is provided.
Example Call:
_10curl -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:
_10platform.getStake({_10 addresses: []string_10}) ->_10{_10 stakeds: string -> int,_10 stakedOutputs: []string,_10 encoding: string_10}
addressesare the addresses to get information about.stakedsis a map from assetID to the amount staked by addresses provided.stakedOutputsare the string representation of staked outputs.encodingspecifies the format for the returned outputs.
Example Call:
_11curl -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:
_10platform.getStakingAssetID({_10 subnetID: string // optional_10}) -> {_10 assetID: string_10}
subnetIDis the Subnetwork whose assetID is requested.assetIDis the assetID for a Subnetwork’s staking asset.
Example Call:
_10curl -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:
_10platform.getSubnetworks({_10 ids: []string_10}) ->_10{_10 Subnetworks: []{_10 id: string,_10 controlKeys: []string,_10 threshold: string_10 }_10}
idsare the IDs of the Subnetworks to get information about. If omitted, gets information about all Subnetworks.idis the Subnet’s ID.thresholdsignatures from addresses incontrolKeysare needed to add a validator to the Subnetwork. If the Subnetwork is a PoS Subnetwork, thenthresholdwill be0andcontrolKeyswill be empty.
See here for information on adding a validator to a Subnetwork.
Example Call:
_10curl -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:
_10platform.getTimestamp() -> {time: string}
Example Call:
_10curl -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:
_10platform.getTotalStake({_10 subnetID: string_10}) -> {_10 stake: int_10 weight: int_10}
Primary Network Example
Example Call:
_10curl -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:
_10curl -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:
_10platform.getTx({_10 txID: string,_10 encoding: string // optional_10}) -> {_10 tx: string,_10 encoding: string,_10}
Example Call:
_10curl -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:
_10platform.getTxStatus({_10 txID: string_10}) -> {status: string}
status is one of:
Committed: The transaction is (or will be) accepted by every nodeProcessing: The transaction is being voted on by this nodeDropped: The transaction will never be accepted by any node in the network, checkreasonfield for more informationUnknown: The transaction hasn’t been seen by this node
Example Call:
_10curl -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:
_21platform.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}
utxosis a list of UTXOs such that each UTXO references at least one address inaddresses.- At most
limitUTXOs are returned. Iflimitis omitted or greater than 1024, it is set to 1024. - This method supports pagination.
endIndexdenotes the last UTXO returned. To get the next set of UTXOs, use the value ofendIndexasstartIndexin the next call. - If
startIndexis omitted, will fetch all UTXOs up tolimit. - When using pagination (that is when
startIndexis 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.
encodingspecifies the format for the returned UTXOs. Can only behexwhen a value is provided.
Example
Suppose we want all UTXOs that reference at least one of
P-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5 and P-dijets1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6.
_10curl -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:
_14curl -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:
_10curl -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:
_10platform.getValidatorsAt(_10 {_10 height: int,_10 subnetID: string, // optional_10 }_10)
heightis the Method Chain height to get the validator set at.subnetIDis the Subnetwork ID to get the validator set of. If not given, gets validator set of the Primary Network.
Example Call:
_10curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
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:
_14platform.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}
tois the ID of the address the DJT is imported to. This must be the same as thetoargument in the corresponding call to the Value Chain’s or Utility Chain'sexport.sourceChainis the chain the funds are coming from. Must be either"X"or"C".fromare the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddris the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.usernameis the user that controls from and change addresses.passwordisusername‘s password.
Example Call:
_12curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Give a user control over an address by providing the private key that controls the address.
Signature:
_10platform.importKey({_10 username: string,_10 password: string,_10 privateKey:string_10}) -> {address: string}
- Add
privateKeytousername‘s set of private keys.addressis the addressusernamenow controls with the private key.
Example Call:
_10curl -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:
_10platform.issueTx({_10 tx: string,_10 encoding: string, // optional_10}) -> {txID: string}
txis the byte representation of a transaction.encodingspecifies the encoding format for the transaction bytes. Can only behexwhen a value is provided.txIDis the transaction’s ID.
Example Call:
_10curl -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#
Not recommended for use on Mainnet. See warning notice in Keystore API.
List addresses controlled by the given user.
Signature:
_10platform.listAddresses({_10 username: string,_10 password: string_10}) -> {addresses: []string}
Example Call:
_10curl -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:
_10platform.sampleValidators(_10 {_10 size: int,_10 subnetID: string, // optional_10 }_10) ->_10{_10 validators: []string_10}
sizeis the number of validators to sample.subnetIDis the Subnetwork to sampled from. If omitted, defaults to the Primary Network.- Each element of
validatorsis the ID of a validator.
Example Call:
_10curl -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:
_10platform.validatedBy(_10 {_10 blockchainID: string_10 }_10) -> {subnetID: string}
blockchainIDis the blockchain’s ID.subnetIDis the ID of the Subnetwork that validates the blockchain.
Example Call:
_10curl -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:
_10platform.validates(_10 {_10 subnetID: string_10 }_10) -> {blockchainIDs: []string}
subnetIDis the Subnet’s ID.- Each element of
blockchainIDsis the ID of a blockchain the Subnetwork validates.
Example Call:
_10curl -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}