Nuklai-Specific RPC Endpoints

These endpoints are designed to provide deeper insights into the Nuklai blockchain's features.

NOTE: Please replace RPC_URLwith your own endpoint. It will be different depending on if you're running Nuklai Subnet locally or interacting with testnet or mainnet.

Genesis

Fetch details about the genesis block.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.genesis"}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.genesis"
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output:

{
  "jsonrpc": "2.0",
  "result": {
    "genesis": {
      "stateBranchFactor": 16,
      "minBlockGap": 250,
      "minEmptyBlockGap": 2500,
      "minUnitPrice": [
        100,
        100,
        100,
        100,
        100
      ],
      "unitPriceChangeDenominator": [
        48,
        48,
        48,
        48,
        48
      ],
      "windowTargetUnits": [
        40000000,
        450000,
        450000,
        450000,
        450000
      ],
      "maxBlockUnits": [
        1800000,
        18446744073709552000,
        18446744073709552000,
        18446744073709552000,
        18446744073709552000
      ],
      "validityWindow": 60000,
      "maxActionsPerTx": 16,
      "maxOutputsPerAction": 1,
      "baseUnits": 1,
      "storageKeyReadUnits": 5,
      "storageValueReadUnits": 2,
      "storageKeyAllocateUnits": 20,
      "storageValueAllocateUnits": 5,
      "storageKeyWriteUnits": 10,
      "storageValueWriteUnits": 3,
      "customAllocation": [
        {
          "address": "nuklai1qpg4ecapjymddcde8sfq06dshzpxltqnl47tvfz0hnkesjz7t0p35d5fnr3",
          "balance": 853000000000000000
        }
      ],
      "emissionBalancer": {
        "maxSupply": 1e+19,
        "emissionAddress": "nuklai1qr4hhj8vfrnmzghgfnqjss0ns9tv7pjhhhggfm2zeagltnlmu4a6sgh6dqn"
      }
    }
  },
  "id": 1
}

Tx

Get information about a specific transaction using its ID.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.tx", "params": {"txId": "2EKPxUcTLmAErdo5J4itjML2GgANWQNZU3zWUZfVL37AhKstKr"}}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.tx",
    params: {
      txId: "2EKPxUcTLmAErdo5J4itjML2GgANWQNZU3zWUZfVL37AhKstKr"
    }
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output:

{
  "jsonrpc": "2.0",
  "result": {
    "timestamp": 1718730763716,
    "success": true,
    "units": [
      224,
      7,
      14,
      50,
      26
    ],
    "fee": 32100
  },
  "id": 1
}

Asset

Retrieve details about a particular asset using its ID.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.asset", "params": {"asset": "NAI"}}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.asset",
    params: {
      asset: "NAI" 
    }
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output for native token "NAI":

{
  "jsonrpc": "2.0",
  "result": {
    "symbol": "NAI",
    "decimals": 9,
    "metadata": "nuklaivm",
    "supply": 853000000000000000,
    "owner": "nuklai1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvn638"
  },
  "id": 1
}

Output for a user created asset "2Cb1hhJQvNkYu8GuEMHDPMiGV1DndXzkw2Q2jaf2b6SLSDVusW":

{
  "jsonrpc": "2.0",
  "result": {
    "symbol": "KP",
    "decimals": 0,
    "metadata": "Amazing Token by KP",
    "supply": 0,
    "owner": "nuklai1qply4qf7m3zk7vsf3vjcms2mpvsjw382kz72txc66xz4gzsylmn25ynnfxk"
  },
  "id": 1
}

Balance

Get information about a specific transaction using its ID.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.balance", "params": {"address": "nuklai1qpg4ecapjymddcde8sfq06dshzpxltqnl47tvfz0hnkesjz7t0p35d5fnr3", "asset": "NAI"}}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.balance",
    params: {
      address: "nuklai1qpg4ecapjymddcde8sfq06dshzpxltqnl47tvfz0hnkesjz7t0p35d5fnr3",
      asset: "NAI" 
    }
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output for native token "NAI":

{
  "jsonrpc": "2.0",
  "result": {
    "amount": 852998788899796100
  },
  "id": 1
}

Output for a user created asset "2Cb1hhJQvNkYu8GuEMHDPMiGV1DndXzkw2Q2jaf2b6SLSDVusW":

{
  "jsonrpc": "2.0",
  "result": {
    "amount": 100
  },
  "id": 1
}

Emission Info

Get detailed information about the current emission state.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.emissionInfo"}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.emissionInfo"
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output:

{
  "jsonrpc": "2.0",
  "result": {
    "currentBlockHeight": 380,
    "totalSupply": 853000000000998800,
    "maxSupply": 1e+19,
    "totalStaked": 150000000000,
    "rewardsPerEpoch": 35673,
    "emissionAccount": {
      "address": "nuklai1qr4hhj8vfrnmzghgfnqjss0ns9tv7pjhhhggfm2zeagltnlmu4a6sgh6dqn",
      "accumulatedReward": 263350
    },
    "epochTracker": {
      "baseAPR": 0.25,
      "baseValidators": 100,
      "epochLength": 10
    }
  },
  "id": 1
}

All Validators

Get information about all the current validators of Nuklai subnet.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.allValidators"}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.allValidators"
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output:

{
  "jsonrpc": "2.0",
  "result": {
    "validators": [
      {
        "isActive": true,
        "nodeID": "NodeID-ABET7F99ZNAnkWfvJC1mdxYjSfuRKbo4t",
        "publicKey": "kVwJIuAsZAt0uZ46wMdy06y8u3SufKKqWJ54MePnBputXCDXcl1m3xwsuKbQmr60",
        "stakedAmount": 100000000000,
        "accumulatedStakedReward": 89772,
        "delegationFeeRate": 0.9,
        "delegatedAmount": 50000000000,
        "accumulatedDelegatedReward": 449470
      },
      {
        "isActive": false,
        "nodeID": "NodeID-4YHfWJBxHqSHKY2CdX6S2dxq1rWFJPTsp",
        "publicKey": "iHySb6ZZmOCr4YeQwwHrLozjIqVxUAHq3GpnujzLdA1EDfxnudL1dVpiGt6/by5N",
        "stakedAmount": 0,
        "accumulatedStakedReward": 0,
        "delegationFeeRate": 0,
        "delegatedAmount": 0,
        "accumulatedDelegatedReward": 0
      },
      {
        "isActive": false,
        "nodeID": "NodeID-PeNewUobPD3MUJSeWXBSyzzZt6jv7aEz2",
        "publicKey": "sibgX7oKDelDx9ycCAvwtvEiTgvFb/M9NLDfC31bCLylHqBD5R1l9NNFnDoKP+6H",
        "stakedAmount": 0,
        "accumulatedStakedReward": 0,
        "delegationFeeRate": 0,
        "delegatedAmount": 0,
        "accumulatedDelegatedReward": 0
      },
      {
        "isActive": false,
        "nodeID": "NodeID-NHBWAYqRW4izcqHSv1BmwvV7HmJL6WtUT",
        "publicKey": "rcF1bTqmSreCZ27vyRUG70Lrm0Z0xml3s4rsMmJXTTqe+gH1ERJb+kGnhISEwcJx",
        "stakedAmount": 0,
        "accumulatedStakedReward": 0,
        "delegationFeeRate": 0,
        "delegatedAmount": 0,
        "accumulatedDelegatedReward": 0
      },
      {
        "isActive": false,
        "nodeID": "NodeID-E4xyadUah9vceZDgJVd6GirYMitMDiGnY",
        "publicKey": "sC+E5P9B2vZ6GrPkP06JYl4Vtjt2y7+GaJ+X7biqy0cZrJTrrWqtQAsiX2ldySBf",
        "stakedAmount": 0,
        "accumulatedStakedReward": 0,
        "delegationFeeRate": 0,
        "delegatedAmount": 0,
        "accumulatedDelegatedReward": 0
      }
    ]
  },
  "id": 1
}

Staked Validators

Get information about the staked validators on the Nuklai subnet.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.stakedValidators"}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.stakedValidators"
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output:

{
  "jsonrpc": "2.0",
  "result": {
    "validators": [
      {
        "isActive": true,
        "nodeID": "NodeID-ABET7F99ZNAnkWfvJC1mdxYjSfuRKbo4t",
        "publicKey": "kVwJIuAsZAt0uZ46wMdy06y8u3SufKKqWJ54MePnBputXCDXcl1m3xwsuKbQmr60",
        "stakedAmount": 100000000000,
        "accumulatedStakedReward": 93340,
        "delegationFeeRate": 0.9,
        "delegatedAmount": 50000000000,
        "accumulatedDelegatedReward": 481575
      }
    ]
  },
  "id": 1
}

Validator Stake

Fetch stake information for a specific validator using their node ID.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.validatorStake", "params": {"nodeID": "NodeID-ABET7F99ZNAnkWfvJC1mdxYjSfuRKbo4t"}}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.validatorStake",
    params: {
      nodeID: "NodeID-ABET7F99ZNAnkWfvJC1mdxYjSfuRKbo4t"
    }
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output:

{
  "jsonrpc": "2.0",
  "result": {
    "stakeStartBlock": 250,
    "stakeEndBlock": 10000000,
    "stakedAmount": 100000000000,
    "delegationFeeRate": 90,
    "rewardAddress": "nuklai1qgylravuk2ye7w2ly4meswx9cpguz9azcz7urvmdmd2qn042v8jx6ejpkc6",
    "ownerAddress": "nuklai1qgylravuk2ye7w2ly4meswx9cpguz9azcz7urvmdmd2qn042v8jx6ejpkc6"
  },
  "id": 1
}

User Stake

Get staking information for a user with a given address and node ID.

cURL:

curl -X POST --data '{"jsonrpc":"2.0", "id" :1, "method" :"nuklaivm.userStake", "params": {"owner": "nuklai1qpg4ecapjymddcde8sfq06dshzpxltqnl47tvfz0hnkesjz7t0p35d5fnr3", "nodeID": "NodeID-ABET7F99ZNAnkWfvJC1mdxYjSfuRKbo4t"}}' -H 'content-type:application/json;' http://RPC_URL/nuklaiapi

JavaScript (using Fetch API):

fetch('RPC_URL/nuklaiapi', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "nuklaivm.userStake",
    params: {
      owner: "nuklai1qpg4ecapjymddcde8sfq06dshzpxltqnl47tvfz0hnkesjz7t0p35d5fnr3",
      nodeID: "NodeID-ABET7F99ZNAnkWfvJC1mdxYjSfuRKbo4t"
    }
  })
})
.then(response => response.json())
.then(data => console.log(data)); 

Output:

{
  "jsonrpc": "2.0",
  "result": {
    "stakeStartBlock": 250,
    "stakeEndBlock": 10000000,
    "stakedAmount": 50000000000,
    "rewardAddress": "nuklai1qpg4ecapjymddcde8sfq06dshzpxltqnl47tvfz0hnkesjz7t0p35d5fnr3",
    "ownerAddress": "nuklai1qpg4ecapjymddcde8sfq06dshzpxltqnl47tvfz0hnkesjz7t0p35d5fnr3"
  },
  "id": 1
}

Last updated