DPoS API

Console API and JSON-RPC API related to DxChain3.0 system contract

JSON-RPC

  1. For example: curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getBaseInfos","params":[],"id":1}' RPC_URL

  2. When querying the specified block height, please make sure that the RPC-URL archive mode is enabled.

dpos_getBaseInfos

dpos.base() in console.

Get all the basic parameters related to the system contract.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

All basic parameters related to the system contract.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getBaseInfos","params":["latest"],"id":1}' RPC_URL

// dpos.base("latest")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "BLACK_HOLE_ADDRESS": "0x0000000000000000000000000000000000000000",
    "BLOCK_SECONDS": 3,
    "EPOCH_BLOCKS": 28800,
    "MAX_LEVEL_VALIDATOR_COUNT": 120,
    "MAX_PUNISH_COUNT": 278,
    "MAX_RATE": 100,
    "MAX_VALIDATORS_COUNT": 210,
    "MAX_VALIDATOR_COUNT_LV1": 21,
    "MAX_VALIDATOR_COUNT_LV2": 33,
    "MAX_VALIDATOR_COUNT_LV3": 66,
    "MAX_VALIDATOR_COUNT_LV4": 99,
    "MAX_VALIDATOR_DETAIL_LENGTH": 1000,
    "MEDIUM_LEVEL_VALIDATOR_COUNT": 90,
    "MIN_DEPOSIT": 40000000000000000000000000,
    "MIN_LEVEL_VALIDATOR_COUNT": 60,
    "MIN_RATE": 70,
    "PROPOSAL_DURATION_EPOCHS": 7,
    "RATE_SET_LOCK_EPOCHS": 1,
    "REWARD_DEPOSIT_FROM_LV1_TO_LV2": 128250000000000000000,
    "REWARD_DEPOSIT_FROM_LV2_TO_LV3": 157125000000000000000,
    "REWARD_DEPOSIT_FROM_LV3_TO_LV4": 180750000000000000000,
    "REWARD_DEPOSIT_FROM_LV4_TO_LV5": 199875000000000000000,
    "REWARD_DEPOSIT_OVER_LV5": 214125000000000000000,
    "REWARD_DEPOSIT_UNDER_LV1": 95250000000000000000,
    "SAFE_MULTIPLIER": 1000000000000000000,
    "TOTAL_DEPOSIT_LV1": 15000000000000000000000000000,
    "TOTAL_DEPOSIT_LV2": 20000000000000000000000000000,
    "TOTAL_DEPOSIT_LV3": 25000000000000000000000000000,
    "TOTAL_DEPOSIT_LV4": 30000000000000000000000000000,
    "TOTAL_DEPOSIT_LV5": 35000000000000000000000000000,
    "VALIDATOR_REWARD_LOCK_EPOCHS": 7,
    "VALIDATOR_UNSTAKE_LOCK_EPOCHS": 1,
    "VOTE_CANCEL_EPOCHS": 1
  }
}

dpos_getAllProposalSets

dpos.allProposalIds()in console.

Get the (bytes4) id of all node application records.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

A list of (bytes4) ids containing all node request records.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getAllProposalSets","params":[],"id":1}'

// dpos.allProposalIds()

//result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "0x53a982a3",
    "0xbfb72c33",
    "0xec7c461a",
    "0x05825efe",
    "0x1a3825df",
    "0xc481b8e5",
    "0xbff1380f",
    "0xb3865b32",
    "0x6ca4c591",
    "0xe3726066",
    "0x45301f57",
    "0xdd5f328b",
    "0x826610de",
    "0x42314de1",
    "0x1aa4138a",
    "0x400ef2b3",
    "0x5e728610",
    "0x774e9a0b",
    "0xa866a331",
    "0x53cfc6f3"
  ]
}

dpos_getAddressProposalSets

dpos.addressProposalIds(address)in console.

Get the (bytes4) id of the node application record of an address.

Parameter

  1. address: Search the address

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0xC737Aaaa44399a32ba7e18222aE38A9609085142",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

A list of (bytes4) ids containing the node request record for an address.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getAddressProposalSets","params":["0xC737Aaaa44399a32ba7e18222aE38A9609085142"],"id":1}'

// dpos.addressProposalIds("0xC737Aaaa44399a32ba7e18222aE38A9609085142")

// result
{ "jsonrpc": "2.0", "id": 1, "result": ["0xc481b8e5"] }

dpos_getProposal

dpos.proposal(id)in console.

Get the detailed information of a node's application record.

Parameter

  1. id: Node application record id

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0xc481b8e5",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • id: Node application id

  • Proposer: The address of applicant

  • Deposit: Amount of staking

  • Rate: Allocation ratio

  • Details: Details of node

  • Name: Node name

  • InitBlock: Block height of application

  • Guarantee: The address of approver

  • UpdateBlock: Record the update block

  • PType: Application type

    • 0 means application

  • Status:

    • 0: pending

    • 1: success

    • 2: cancel

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getProposal","params":["0xc481b8e5"],"id":1}'curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getProposal","params":["0xc481b8e5"],"id":1}'

// dpos.proposal("0xc481b8e5")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "Id": "0xc481b8e5",
    "Proposer": "0xc737aaaa44399a32ba7e18222ae38a9609085142",
    "PType": 0,
    "Deposit": 40000000000000000000000000,
    "Rate": 90,
    "Details": "0xC737Aaaa44399a32ba7e18222aE38A9609085142",
    "Name": "dxc-validator-1",
    "InitBlock": 2947,
    "Guarantee": "0xd7a53c68ad615906484a17fed3ebe298ad389fec",
    "UpdateBlock": 2956,
    "Status": 1
  }
}

dpos_getAllProposals

dpos.allProposals()in console.

Get a detailed list of application records for all nodes.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Contains a detailed list of application records for all nodes.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getAllProposals","params":[],"id":1}'

// dpos.allProposals()

// result 
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "Id": "0x53a982a3",
      "Proposer": "0x678abf6ced79a791e28fd6200b2fd781227f05b4",
      "PType": 0,
      "Deposit": 40000000000000000000000000,
      "Rate": 90,
      "Details": "0x678aBF6cED79A791E28fD6200B2Fd781227F05b4",
      "Name": "dxc-validator-13",
      "InitBlock": 2947,
      "Guarantee": "0xd7a53c68ad615906484a17fed3ebe298ad389fec",
      "UpdateBlock": 2956,
      "Status": 1
    },
    {
      "Id": "0xbfb72c33",
      "Proposer": "0x08c5ac6769b036567ba7259313fa2eb084f83218",
      "PType": 0,
      "Deposit": 40000000000000000000000000,
      "Rate": 90,
      "Details": "0x08c5aC6769b036567ba7259313fa2Eb084f83218",
      "Name": "dxc-validator-10",
      "InitBlock": 2947,
      "Guarantee": "0xd7a53c68ad615906484a17fed3ebe298ad389fec",
      "UpdateBlock": 2956,
      "Status": 1
    },
    ...
  ]
}

dpos_getAddressProposals

dpos.addressProposals(address)in console.

Get a list of all application record details for this address.

Parameter

  1. address: Look up the address

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0xC737Aaaa44399a32ba7e18222aE38A9609085142",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Contains a list of all application record details for this address.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getAddressProposals","params":["0xC737Aaaa44399a32ba7e18222aE38A9609085142"],"id":1}'

// dpos.addressProposals("0xC737Aaaa44399a32ba7e18222aE38A9609085142")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "Id": "0xc481b8e5",
      "Proposer": "0xc737aaaa44399a32ba7e18222ae38a9609085142",
      "PType": 0,
      "Deposit": 40000000000000000000000000,
      "Rate": 90,
      "Details": "0xC737Aaaa44399a32ba7e18222aE38A9609085142",
      "Name": "dxc-validator-1",
      "InitBlock": 2947,
      "Guarantee": "0xd7a53c68ad615906484a17fed3ebe298ad389fec",
      "UpdateBlock": 2956,
      "Status": 1
    }
  ]
}

dpos_getValidator

dpos.validator(validator)in console.

Get details for this node.

Parameter

  1. validator: Look up the address

  2. blockNum:null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0xC737Aaaa44399a32ba7e18222aE38A9609085142",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • Deposit

  • Details

  • Name

  • Rate

  • RateSettLockingEndBlock: The block height for next edit

  • UnstakeLockingEndBlock: The block height of unlock staking

  • Votes

  • Status:

    • 0: Defalt Status: Cancelled or not a node

    • 1: Cancellation is under processing, staking has not been redeemed

    • 2: Queueing

    • 3: Node is kicked

    • 4: Node is valid

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getValidator","params":["0xC737Aaaa44399a32ba7e18222aE38A9609085142"],"id":1}'

// dpos.validator("0xC737Aaaa44399a32ba7e18222aE38A9609085142")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "Status": 4,
    "Deposit": 400000000000000000000000000,
    "Rate": 90,
    "Name": "dxc-validator-1",
    "Details": "0xC737Aaaa44399a32ba7e18222aE38A9609085142",
    "Votes": 4010000000000000000000000,
    "UnstakeLockingEndBlock": 0,
    "RateSettLockingEndBlock": 0
  }
}

dpos_getCurrentEpochValidators

dpos.currentEpochValidators()in console.

Get the validators' address list of the latest epoch.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

List of validators' addresses for the latest epoch.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getCurrentEpochValidators","params":[],"id":1}'

// dpos.currentEpochValidators()

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "0xd7a53c68ad615906484a17fed3ebe298ad389fec",
    "0x678abf6ced79a791e28fd6200b2fd781227f05b4",
    "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
    "0x1a42a60ac116ec8288b0b75a673d778437f77bb8",
    "0xc737aaaa44399a32ba7e18222ae38a9609085142",
    "0x8ff49bc9fbda10dbe327ec06306761183cf7ef11",
    ...
  ]
}

dpos_isEffictiveValidator

dpos.isEffictiveValidator(address)in console.

Check if the node of this address is a validator or not.

Parameter

  1. address

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

If the node of this address is a validator or not.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_isEffictiveValidator","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e"],"id":1}'

// dpos.isEffictiveValidator("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e")

// result 
{ "jsonrpc": "2.0", "id": 1, "result": true }

dpos_effictiveValsLength

dpos.effictiveValsLength()in console.

Get the current number of validators.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

The number of validators.

Example

// curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_effictiveValsLength","params":[],"id":1}'curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_effictiveValsLength","params":[],"id":1}'

// dpos.effictiveValsLength()

// result
{ "jsonrpc": "2.0", "id": 1, "result": 21 }

dpos_getEffictiveValidators

dpos.effictiveValidators()in console.

Get the current list of valid node addresses.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

List of valid node addresses.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getEffictiveValidators","params":[],"id":1}'

// dpos.effictiveValidators()

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "0xd7a53c68ad615906484a17fed3ebe298ad389fec",
    "0x678abf6ced79a791e28fd6200b2fd781227f05b4",
    "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
    "0x1a42a60ac116ec8288b0b75a673d778437f77bb8",
    "0xc737aaaa44399a32ba7e18222ae38a9609085142",
    "0x8ff49bc9fbda10dbe327ec06306761183cf7ef11",
    "0x43d3436a1381405e868a9a2ce534a6d8160b9b07",
    "0xa9d3a05f3568e04c65b368693439cd8c0586a51c",
    ...
  ]
}

dpos_cancelQueueValidatorsLength

dpos.cancelQueueValsLength()in console.

Get the length of the canceled node queue in this epoch.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Length

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_cancelQueueValidatorsLength","params":[],"id":1}'

// dpos.cancelQueueValsLength()

// result
{ "jsonrpc": "2.0", "id": 1, "result": 0 }

dpos_getCancelQueueValidators

dpos.cancelQueueValidators()in console.

Get the list of the canceled node queue in this period.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

List

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getCancelQueueValidators","params":[],"id":1}'curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getCancelQueueValidators","params":[],"id":1}'

// dpos.cancelQueueValidators()

// result
{ "jsonrpc": "2.0", "id": 1, "result": ["0xc737aaaa44399a32ba7e18222ae38a9609085142"] }

dpos_validatorVotersLength

dpos.validatorVotersLength(validator)in console.

Get the number of voters of the validating node.

Parameter

  1. validator

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Number

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_validatorVotersLength","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e"],"id":1}'

// dpos.validatorVotersLength("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e")

// result
{ "jsonrpc": "2.0", "id": 1, "result": 2 }

dpos_getValidatorVoters

dpos.validatorVoters(validator)in console.

Get the list of voter addresses of validators.

Parameter

  1. validator

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Address list

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getValidatorVoters","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e"],"id":1}'

// dpos.validatorVoters("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    "0x6b246a131e2c59108c841e9bc725acad3d3ee3f0",
    "0xa88548e97af8809afac9dc7a930650c117951059"
  ]
}

dpos_pendingValidatorReward

dpos.pendingValidatorReward(validator)in console.

Reward info of nodes

Parameter

  1. validator

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • avaliable: available reward

  • frozen: frozen reward

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_pendingValidatorReward","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e"],"id":1}'

// dpos.pendingValidatorReward("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": { "avaliable": 0, "frozen": 24060626250000000000000 }
}

dpos_validatorRewardsInfo

dpos.validatorRewardsInfo(validator)in console.

Get the information of reward, redemption ,and lock epoch.

Parameter

  1. validator

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • Epochs: Lock time for the reward

  • DelegatorsRewards: The corresponding reward allocated to voter in the epoch.

  • Rates: The corresponding reward allocation.

  • ValidatorRewards: The corresponding block reward.

  • FrozenReward: Total reward freezed.

  • PendingReward: Available Reward

  • RewardPerVote: The block reward per vote.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_validatorRewardsInfo","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e"],"id":1}'

// dpos.validatorRewardsInfo("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "Epochs": [1, 2],
    "ValidatorRewards": [12405836250000000000000, 11718131250000000000000],
    "DelegatorsRewards": [111652526250000000000000, 105463181250000000000000],
    "Rates": [90, 90],
    "PendingReward": 0,
    "FrozenReward": 24123967500000000000000,
    "RewardPerVote": 27843522755610972
  }
}

dpos_validatorRewardInfoByEpoch

dpos.validatorRewardInfoByEpoch(validator, epoch)in console.

Get the reward distribution information of the node in this epoch: block reward, reward allocated to voters and allocation ratio.

Parameter

  1. validator

  2. epoch

  3. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   1,
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • DelegatorsReward

  • Rate

  • ValidatorReward

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_validatorRewardInfoByEpoch","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",1],"id":1}'

// dpos.validatorRewardInfoByEpoch("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",1)

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "ValidatorReward": 12405836250000000000000,
    "DelegatorsReward": 111652526250000000000000,
    "Rate": 90
  }
}

dpos_pendingVoteReward

dpos.pendingVoteReward(validator, voter)in console.

Get the reward info of a validator.

Parameter

  1. validator: Address of validator

  2. voter: Address of voter

  3. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   "0xA88548E97AF8809aFaC9dC7a930650c117951059",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Reward info

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_pendingVoteReward","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e","0xA88548E97AF8809aFaC9dC7a930650c117951059"],"id":1}'

// dpos.pendingVoteReward("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e","0xA88548E97AF8809aFaC9dC7a930650c117951059")

// result
{ "jsonrpc": "2.0", "id": 1, "result": 111457621590710720916000 }

dpos_votesRewardRedeemInfo

dpos.votesRewardRedeemInfo(validator, voter)in console.

Get the votes, rewards, and redemption information.

Parameter

  1. validator

  2. voter

  3. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   "0xA88548E97AF8809aFaC9dC7a930650c117951059",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • Amount: Amount of votes

  • LockRedeemEpochs: The epoch to redeem votes

  • LockRedeemVotes: Redeemable amount

  • PendingRedeem: Available amount to redeem

  • PendingReward: Available assets to collect

  • ValidatorTotalVotes: Total vote of the validator

  • Validator: The address of validator

  • ValidatorName

  • ValidatorRate

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_votesRewardRedeemInfo","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e","0xA88548E97AF8809aFaC9dC7a930650c117951059"],"id":1}'

// dpos.votesRewardRedeemInfo("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e","0xA88548E97AF8809aFaC9dC7a930650c117951059")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "Validator": "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
    "ValidatorName": "dxc-validator-9",
    "ValidatorRate": 90,
    "ValidatorTotalVotes": 4010000000000000000000000,
    "Amount": 4003000000000000000000000,
    "PendingReward": 111457621590710720916000,
    "PendingRedeem": 0,
    "LockRedeemEpochs": [],
    "LockRedeemVotes": []
  }
}

dpos_votesRewardRedeemInfos

dpos.votesRewardRedeemInfos(voter)in console.

Get vote, reward, and redemption information of all voted nodes.

Parameter

  1. voter

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0xA88548E97AF8809aFaC9dC7a930650c117951059",
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Vote, reward, and redemption information of all voted nodes.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_votesRewardRedeemInfos","params":["0xA88548E97AF8809aFaC9dC7a930650c117951059"],"id":1}'

// dpos.votesRewardRedeemInfos("0xA88548E97AF8809aFaC9dC7a930650c117951059")

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "Validator": "0xd7a53c68ad615906484a17fed3ebe298ad389fec",
      "ValidatorName": "dxc-validator-0",
      "ValidatorRate": 70,
      "ValidatorTotalVotes": 4010000000000000000000000,
      "Amount": 4003000000000000000000000,
      "PendingReward": 2688153013650465652505000,
      "PendingRedeem": 0,
      "LockRedeemEpochs": [],
      "LockRedeemVotes": []
    },
    {
      "Validator": "0x061c4df9c6a879976054219aa50ffc8001543573",
      "ValidatorName": "dxc-validator-14",
      "ValidatorRate": 90,
      "ValidatorTotalVotes": 4009888900000000000000000,
      "Amount": 4002888900000000000000000,
      "PendingReward": 111457616190584137678286,
      "PendingRedeem": 111100000000000000000,
      "LockRedeemEpochs": [],
      "LockRedeemVotes": []
    },
    ...
  ]
}

dpos_getTotalDeposit

dpos.totalDeposit()in console.

Total staking of all valid nodes.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Total staking amount.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getTotalDeposit","params":[],"id":1}' 

// dpos.totalDeposit()

// result
{ "jsonrpc": "2.0", "id": 1, "result": 41160000112000000000000000000 }

dpos_getTotalVotes

dpos.totalVotes()in console.

The total amount of votings.

Parameter

  1. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

Total votings.

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_getTotalVotes","params":[],"id":1}'

// dpos.totalVotes()

// result
{ "jsonrpc": "2.0", "id": 1, "result": 19160000192900000000000000000 }

dpos_epochInfo

dpos.epochInfo(epoch)in console.

Get the block rewards, number of validators, total locked values, and number of nodes when the current epoch starts.

Parameter

  1. epoch

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   2,
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • BlockReward

  • ValidatorCount

  • effictiveValCount

  • TVL: Node staking plus users' votes

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_epochInfo","params":[2],"id":1}'

// dpos.epochInfo(2)

// result 
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "BlockReward": 95250000000000000000,
    "Tvl": 59960000002900000000000000000,
    "ValidatorCount": 21,
    "EffictiveValCount": 21
  }
}

dpos_kickoutInfo

dpos.kickoutInfo(epoch)in console.

The address list of kicked nodes in this epoch.

Parameter

  1. epoch

  2. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   2,
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

The address list

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_kickoutInfo","params":[2],"id":1}'

// dpos.kickoutInfo(2)

// result
{ "jsonrpc": "2.0", "id": 1, "result": [] }

dpos_punishInfo

dpos.punishInfo(validator,epoch)in console.

The details of punished nodes (if any).

Parameter

  1. validator

  2. epoch

  3. blockNum: null |'latest' | 'earliest' | 'pending' | 'hex number'

params: [
   "0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",
   2,
   null |'latest' | 'earliest' | 'pending' | 'hex number'
]

Return

  • Count

  • PunishBlocks

  • BurnRewards: The burnt block reward of each kick out

  • KickoutBlocks

Example

curl -H 'content-type:application/json' -d '{"jsonrpc":"2.0","method":"dpos_punishInfo","params":["0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",2],"id":1}'

// dpos.punishInfo("0x577aaf7227a269f39cbdc2ab9545b7d2f17cab4e",2)

// result
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "Count": 0,
    "PunishBlocks": [],
    "KickoutBlocks": [],
    "BurnRewards": []
  }
}

Last updated