GWAN PoS API
Wanchain GWAN PoS API Manual
The API interface can be called after a user links to a GWAN node through IPC or RPC.
This manual lists and explains all POS-APIs.
Contents
1. PoS-API
1.1. Basic Info Queries
1.1.1. version
1.1.2. getPosInfo
1.1.3. getEpochID
1.1.4. getEpochBlkCnt
1.1.5. getEpochIDByTime
1.1.6. getEpochIdByBlockNumber
1.1.7. getSlotID
1.1.8. getSlotCount
1.1.9. getSlotIDByTime
1.1.10. getSlotTime
1.1.11. getChainQuality
1.1.12. getLocalPK
1.1.13. getMaxStableBlkNumber
1.1.14. getReorgState
1.1.15. getTimeByEpochID
1.1.16. getWhiteListConfig
1.1.17. getWhiteListbyEpochID
1.2. Reward Info Queries
1.2.1. getEpochIncentivePayDetail
1.2.2. getEpochIncentiveBlockNumber
1.2.3. getEpochIncentive
1.2.4. getEpochGasPool
1.2.5. getEpochRemain
1.2.6. getIncentivePool
1.3. Election Information Queries
1.3.1. getEpochStakerInfo
1.3.2. getEpochStakerInfoAll
1.3.3. getEpochLeadersAddrByEpochID
1.3.4. getEpochLeadersByEpochID
1.3.5. calProbability
1.3.6. getEpochStakeOut
1.3.7. getLeaderGroupByEpochID
1.3.8. getRandomProposersAddrByEpochID
1.3.9. getRandomProposersByEpochID
1.3.10. getSlStage
1.3.11. getRbSignatureCount
1.3.12. getRbStage
1.3.13. getSlotLeaderByEpochIDAndSlotID
1.3.14. getStakerInfo
1.3.15. getValidRBCnt
1.3.16. getValidSMACnt
1.4. Random Number Query
1.4.1. getRandom
1.5. Activity Queries
1.5.1. getActivity
1.5.2. getSlotActivity
1.5.3. getValidatorActivity
1.6. Deprecated API
1.6.1. getBootNodePK
1.6.2. getIncentiveRunTimes
1.6.3. getRBAddress
1.6.4. getSlotCreateStatusByEpochID
1.6.5. getSlotScCallTimesByEpochID
1.6.6. getSmaByEpochID
1.6.7. getTotalIncentive
1.6.8. getTotalRemain
1. PoS-API
1.1. Basic Info Queries
1.1.1. version
Get version information of POS-API
1.1.2. getPosInfo
Obtain upgrade location information from the POW protocol to the POS protocol
Where firstBlockNumber
is the block number of the first POS
firstEpochId
is the Epoch ID under the first POS protocol. In the POW phase, this value is 0.
1.1.3. getEpochID
Get current Epoch ID
1.1.4. getEpochBlkCnt
Get the number of output blocks of the specified epoch, the input parameter is Epoch ID
1.1.5. getEpochIDByTime
Epoch ID based on time, enter UTC time seconds, return Epoch ID
1.1.6. getEpochIdByBlockNumber
Get the Epoch ID based on the block number
1.1.7. getSlotID
Get the current Slot ID
1.1.8. getSlotCount
Get the number of slots in an epoch
1.1.9. getSlotIDByTime
Calculate the Slot ID based on time, enter the UTC time seconds, and return the Slot ID.
1.1.10. getSlotTime
Get the time span of a slot in seconds
1.1.11. getChainQuality
Get chain quality information. Enter epoch ID and slot ID, return chain quality value is a thousand points, for example, 770 means 77.0%. Chain quality is based on node ping time and activeness parameters.
1.1.12. getLocalPK
Get the public key of the staking account of the local node
1.1.13. getMaxStableBlkNumber
Get the current maximum stable block number (block which will not roll back)
1.1.14. getReorgState
Get the current epoch rollback status, enter the epoch id, returns the number of rollbacks and the maximum rollback length
1.1.15. getTimeByEpochID
Get the start time of the specified epoch, returns UTC time seconds
1.1.16. getWhiteListConfig
Obtain the configuration information of the Wanchain Foundation controlled nodes, including the effective epochID, the number of controlled nodes, and the starting sequence number.
1.1.17. getWhiteListbyEpochID
Get the list of Wanchain Foundation controlled node public keys for the specified epoch
1.2. Reward Info Queries
1.2.1. getEpochIncentivePayDetail
Get the reward information for the specified epoch, enter epochID, return the reward payment details (including RNP reward, EL reward and block reward) for all verification nodes and delegators working at this epoch)
1.2.2. getEpochIncentiveBlockNumber
Get the block number where incentives are issued in the specified epoch, the input parameter is epochID
1.2.3. getEpochIncentive
Get the total incentives amount issued in the specified epoch, enter epochID to return the incentives amount in Wei
1.2.4. getEpochGasPool
Get the total transaction fees for the specified epoch in Wei
1.2.5. getEpochRemain
Get the remaining rewards that have not been issued in the specified epoch due to validator inactivity. This reward will be added to the total rewards for the next 365 epoch cycle.
1.2.6. getIncentivePool
Get the incentives pool sizes of the specified epoch, the return values are the total reward, the foundation reward, and the transaction fee reward
1.3. Election Information Queries
1.3.1. getEpochStakerInfo
Get the staking weight information of the specified validator of the specified epoch. The input parameters are epochID and validator address.
Where TotalProbability is the total weight value selected for this certifier
The Infors field contains the various sub-items in the total weight. The first sub-item is the validator itself, and the rest is its delegators.
1.3.2. getEpochStakerInfoAll
Get all the validator node information of the specified epoch, the input parameter is epochID
Individual fields are the same as getEpochStakerInfo
1.3.3. getEpochLeadersAddrByEpochID
Get the list of epoch leader addresses for the specified epoch, the input parameter is EpochID.
1.3.4. getEpochLeadersByEpochID
Get the list of epoch leader public keys of the specified epoch, the input parameter is EpochID
1.3.5. calProbability
Calculate the number of election tickets awarded for a given amount of WAN and staking time in Epochs.
1.3.6. getEpochStakeOut
Get amount of stake in WAN withdrawn for the indicated epoch.
1.3.7. getLeaderGroupByEpochID
Get the list of EL and RNP addresses and public keys for the specified epoch.
Type is 0 for Epoch Leader, 1 for Random Number Proposer.
The pubBn256 value is 0x for the Wanchain Foundation controlled nodes.
1.3.8. getRandomProposersAddrByEpochID
Get the address list of Random Number Proposers for the specified epoch
1.3.9. getRandomProposersByEpochID
Get the public key 2 list of Random Number Proposer for the specified epoch (public key 2 is used for RNP operations)
1.3.10. getSlStage
Obtain the indicated slot's EL work stage, enter slotID as parameter.
1.3.11. getRbSignatureCount
Get the number of RNP signatures in the specified epoch, enter epochID and blockNumber, blockNumber is -1 for the latest block
1.3.12. getRbStage
Get the RNP working phases of the specified slot, the input parameter is slotID, there are a total of 6 phases
1.3.13. getSlotLeaderByEpochIDAndSlotID
Get the Slot Leader public key of the specified epoch and specified slot
1.3.14. getStakerInfo
Get the validator details for the specified blockNumber
amount:principal stake of validator node
clients: list of delegators
votingPower: the validator's 'tickets' for the lottery for EL and RNP roles, determined by amount of stake and locking time
quitEpoch: The epoch number where delegators will receive their delegation back if the validator quits. Returns 0 when the validator is not quitting.
feeRate: Commission rate (an integer from 0 to 10000, so 500 would be a 5% commission)
feeRateChangedEpoch: The most recent epoch ID in which feeRate was changed
from: The funding account for the principal stake
lockEpochs: The current epoch locking period in epochs
maxFeeRate: Maximum fee rate
nextLockEpochs: The locking period of the next cycle in epochs. When this value is 0, it will exit in the next cycle and the principal will be refunded.
stakingEpoch: The epoch ID of the work starting time of this locking period
1.3.15. getValidRBCnt
Get the number of RNPs that execute the protocol in the specified epoch Enter epoch ID, returns the number of RNP nodes which have effectively participated in the DKG1, DKG2, and SIGN stages of random number generation for the specified epoch.
1.3.16. getValidSMACnt
Obtains the number of ELs participating in the POS protocol for the specified epoch, and returns the number of valid participants for SMA1 and SMA2 stages respectively.
1.4. Random Number Query
1.4.1. getRandom
Query the random number generation result for the specified blockNumber and epoch. If blockNumber is -1, it indicates the latest block.
If the random number does not exist, Error: no random number exists is returned, indicating that the random number of the epoch has not been generated, or because the number of participating RNPs is below the required threshold, the generation fails. The default random number is used when it fails.
1.5. Activity Queries
1.5.1. getActivity
Get the activity information of the specified epoch, for historical epochs it is a fixed value, and for the current epoch it will update with the latest current value in real time.
Where epLeader is the epoch leader list of the epoch, and epActivity is whether the epoch leader in the corresponding list completes all EL protocol work.
rpLeader is the list of random number proposers of the epoch, rpActivity shows the activity of the RNPs of the corresponding list, with 1 indicating all work has been completed.
sltLeader is the selected list of exporters, which does not contain controlled nodes. slBlocks is the actual number of outbound blocks for each person in the sltLeader list.
slActivity is the activity of this epoch, which is the total number of produced blocks divided by the total number of slots in the epoch.
slCtrlCount is the number of blocks produced by the Wanchain Foundation controlled nodes in this epoch.
1.5.2. getSlotActivity
Get the activity for the blocks produced in the spefified epoch
sltLeader is the list of selected block producers, which does not contain Wanchain Foundation controlled nodes. slBlocks is the actual number of blocks for each node in the sltLeader list.
slActivity is the activity of this epoch, which is the total number of outbound blocks divided by the total number of slots in the epoch.
slCtrlCount The number of blocks produced by the Wanchain Foundation controlled nodes in this epoch.
1.5.3. getValidatorActivity
Get the activity information of the specified Epoch's EL and RNP, for current epochs or future epochs returns null
Where epLeader is the epoch leader list of the epoch, and epActivity is whether the epoch leader in the corresponding list completes all required EL protocol work.
rpLeader is the list of random number proposers of the epoch, rpActivity shows whether the corresponding RNP has completed all work required by the protocol.
1.6. Deprecated API
The following API interfaces have been deprecated and will be removed in subsequent releases.
1.6.1. getBootNodePK
1.6.2. getIncentiveRunTimes
1.6.3. getRBAddress
1.6.4. getSlotCreateStatusByEpochID
1.6.5. getSlotScCallTimesByEpochID
1.6.6. getSmaByEpochID
1.6.7. getTotalIncentive
1.6.8. getTotalRemain
Last updated