DPoS API

和DxChain3.0系统合约相关的console API 、JSON-RPC API。

JSON-RPC

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

  2. 指定区块高度查询时,需要确保RPC-URL开启了归档(archive)节点模式。

dpos_getBaseInfos

dpos.base() in console.

获取系统合约相关的全部基本参数。

参数 Parameters

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值 Returns

系统合约相关的全部基本参数。

示例 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.

获取所有的节点申请记录的(bytes4)id。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

包含所有的节点申请记录的(bytes4)id的列表。

示例

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.

获取某个地址的节点申请记录的(bytes4)id。

参数

  1. address:查询地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

包含某个地址的节点申请记录的(bytes4)id的列表。

示例

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.

获取某个节点申请记录的详细信息。

参数

  1. id:节点申请记录id

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • Id:节点申请id

  • Proposer:节点申请发起地址

  • Deposit:质押数量

  • Rate:分配比例

  • Details:节点描述

  • Name:节点名称

  • InitBlock:申请时的区块高度

  • Guarantee:同意人地址

  • UpdateBlock:记录更新块高

  • PType:类型

    • 0为申请节点

  • Status:状态(ps:该字段并不完全代表申请的状态,需要和'申请有效期'结合)

    • 0:申请中 pending

    • 1:通过 success

    • 2:已取消 cancel

示例

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.

获取所有节点的申请记录的详细信息列表。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

包含所有节点的申请记录的详细信息列表。

示例

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.

获取该地址的所有申请记录详细信息列表。

参数

  1. address:查询地址

  2. blockNum:可选参数null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

包含该地址的所有申请记录详细信息列表。

示例

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.

获取节点的详细信息。

参数

  1. validator:查询地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • Deposit:自身质押

  • Details:节点描述

  • Name:节点名称

  • Rate:节点分配比例(%)

  • RateSettLockingEndBlock:下一次可修改rate的区块高度

  • UnstakeLockingEndBlock:赎回节点质押的区块高度

  • Votes:用户投票数

  • Status:节点状态

    • 0:默认状态:已取消、非节点

    • 1:取消中且未赎回质押

    • 2:取消节点队列中

    • 3:节点被踢除

    • 4:有效节点

示例

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.

获取最新周期的出块节点地址列表。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

最新周期的出块节点地址列表。

示例

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.

判断地址是否有效的验证节点。

参数

  1. address:地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

bool:地址是否有效的验证节点。

示例

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.

获取当前有效节点个数。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

当前有效节点个数。

示例

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

获取当前有效节点地址列表。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

当前有效节点地址列表。

示例

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.

获取该周期内取消节点队列长度。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

该周期内取消节点队列长度。

示例

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.

获取该周期内的取消节点队列。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

该周期内的取消节点队列。

示例

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.

获取验证节点的投票人个数。

参数

  1. validator:验证节点地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

验证节点的投票人个数。

示例

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.

获取验证节点的投票人地址列表。

参数

  1. validator:验证节点地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

验证节点的投票人地址列表。

示例

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.

获取节点的奖励信息。

参数

  1. validator:验证节点地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • avaliable:可领取奖励

  • frozen:锁定奖励

示例

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.

获取节点的奖励、赎回信息、奖励锁定周期信息。

参数

  1. validator:验证节点地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • Epochs:存在锁定奖励的周期

  • DelegatorsRewards:周期对应的分配给投票人的奖励

  • Rates:周期对应的奖励分配比例

  • ValidatorRewards:周期对应的节点出块奖励

  • FrozenReward:锁定总奖励

  • PendingReward:可领取的奖励

  • RewardPerVote:该节点的每一票可领取的投票奖励

示例

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.

获取节点该周期的奖励分配信息:出块奖励、分配给投票人的奖励、分配比例

参数

  1. validator:验证节点地址

  2. epoch:周期

  3. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • DelegatorsReward:本周期节点分配给投票人的奖励

  • Rate:本周期节点的奖励分配比例

  • ValidatorReward:本周期节点自身的出块奖励

示例

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.

获取投票人对某个验证节点的投票奖励。

参数

  1. validator:验证节点地址

  2. voter:投票人地址

  3. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

投票人对某个验证节点的投票奖励。

示例

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.

获取投票人对某个节点的投票、奖励、赎回信息。

参数

  1. validator:验证节点地址

  2. voter:投票人地址

  3. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • Amount:投票数量

  • LockRedeemEpochs:可赎回投票的周期

  • LockRedeemVotes:可赎回投票周期对应的投票数量

  • PendingRedeem:当前即可赎回的投票数量

  • PendingReward:可领取的奖励

  • ValidatorTotalVotes:节点当前的总得票数

  • Validator:节点地址

  • ValidatorName:节点名称

  • ValidatorRate:节点当前分配比例

示例

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.

获取投票人对所有它投票的节点的投票、奖励、赎回信息。

参数

  1. voter:投票人地址

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

投票人对所有它投票的节点的投票、奖励、赎回信息

示例

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.

获取所有有效节点的总质押量。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

所有有效节点的总质押量。

示例

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.

获取所有投票人的总投票数量。

参数

  1. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

所有投票人的总投票数量。

示例

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.

获取本周期的区块奖励、出块节点个数、总锁定量Tvl、周期开始时的超级节点数量。

参数

  1. epoch:周期

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • BlockReward:本周期的出块奖励

  • ValidatorCount:本周期的出块节点个数

  • effictiveValCount:周期开始时的有效验证节点数量

  • Tvl:总锁定量=节点质押+用户投票

示例

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.

获取该周期被踢除的节点地址列表。

参数

  1. epoch:周期

  2. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

该周期被踢除的节点地址列表。

示例

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.

获取该周期某个节点被惩罚的详细信息。

参数

  1. validator:节点地址

  2. epoch:周期

  3. blockNum:可选参数 null |'latest' | 'earliest' | 'pending' | 'hex number'

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

返回值

  • Count:惩罚次数

  • PunishBlocks:惩罚记录的块高

  • BurnRewards:每次kickout销毁的奖励

  • KickoutBlocks:kickout记录的块高

示例

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