# ConsensusGroup
# Contract Specification
Built-in consensus group contract. Contract address is vite_0000000000000000000000000000000000000004d28108e76b
ABI:
# register_getRegisterData
Generate request data for registering a new supernode in the specified consensus group. Equivalent to Register
method in ABI.
Parameters:
Gid
: Consensus group IDstring
: Supernode nameAddress
: Block producing address
Returns:
[]byte
Data
Example:
# register_getCancelRegisterData
Generate request data for cancelling existing supernode registration in the specified consensus group. Equivalent to CancelRegister
method in ABI.
Parameters:
Gid
: Consensus group IDstring
: Supernode name
Returns:
[]byte
Data
Example:
# register_getRewardData
Generate request data for retrieving supernode rewards if applied. Rewards in 90 days(or all accumulated un-retrieved rewards if less than 90 days) since last retrieval can be retrieved per request. Cannot retrieve rewards generated in recent 30 minutes. Equivalent to Reward
method in ABI.
Parameters:
Gid
: Consensus group IDstring
: Supernode nameAddress
: The address to receive rewards
Returns:
[]byte
Data
Example:
# register_getUpdateRegistrationData
Generate request data for changing block producer in existing registration. Equivalent to UpdateRegistration
method in ABI.
Parameters:
Gid
: Consensus group ID, must be the same value as registered and cannot be changedstring
: Supernode name, must be the same value as registered and cannot be changedAddress
: New block producing address
Returns:
[]byte
Data
Example:
# register_getRegistrationList
Return a list of supernodes registered in the specified consensus group by account, ordered by expiration height
Parameters:
Gid
: Consensus group IDAddress
: Staking address
Returns:
Array<RegistartionInfo>
name
:string
Supernode namenodeAddr
:Address
Block producing addresspledgeAddr
:Address
Staking addresspledgeAmount
:big.Int
Staking amountwithdrawHeight
:uint64
Staking expiration heightwithdrawTime
:uint64
Estimated staking expiration timecancelHeight
:uint64
Staking cancellation time. If the value > 0, meaning already cancelled.
- Example:
# register_getAvailableReward
Return un-retrieved rewards in the specified consensus group by supernode name
Parameters:
Gid
: Consensus group IDstring
: Supernode name
Returns:
RewardInfo
totalReward
:string
Accumulated un-retrieved rewardsblockReward
:Address
Accumulated un-retrieved block creation rewardsvoteReward
:Address
Accumulated un-retrieved candidate additional rewards(voting rewards)drained
:bool
Returntrue
only if the supernode has been canceled and all un-retrieved reward is zero
- Example:
# register_getRewardByDay
Return daily rewards for all supernodes in the specified consensus group by timestamp
Parameters:
Gid
: Consensus group IDtimestamp
: Unix timestamp
Returns:
map<string>RewardInfo
totalReward
:string
Total rewards in the dayblockReward
:Address
Block creation rewards in the dayvoteReward
:Address
Candidate additional rewards(voting rewards) in the dayexpectedBlockNum
:uint64
Target block producing number in the day. If zero block is produced by all supernodes in a round, the target block producing number in this round won't be counted in that of the dayblockNum
:uint64
Real block producing number in the day
- Example:
# register_getRewardByIndex
Return daily rewards for all supernodes in the specified consensus group by cycle
Parameters:
Gid
: Consensus group IDuint64
: Index of cycle in 24h starting at 0 from 12:00:00 UTC+8 05/21/2019
Returns:
Object
rewardMap
:map<string>RewardInfo
Detailed reward informationstartTime
:int64
Start timeendTime
:int64
End time
- Example:
# register_getCandidateList
Return a list of SBP candidates in snapshot consensus group
Parameters:
Returns:
Array<CandidateInfo>
name
:string
SBP namenodeAddr
:Address
Block producing addressvoteNum
:string
Number of votes
- Example:
# vote_getVoteData
Generate request data for voting for the named supernode in the specified consensus group. Equivalent to Vote
method in ABI.
Parameters:
Gid
: Consensus group IDstring
: Supernode name
Returns:
[]byte
Data
Example:
# vote_getCancelVoteData
Generate request data for cancelling voting in the specified consensus group. Equivalent to CancelVote
method in ABI.
Parameters:
Gid
: Consensus group ID
Returns:
[]byte
Data
Example:
# vote_getVoteInfo
Return the voting information in the specified consensus group by account
Parameters:
Gid
: Consensus group IDAddress
: Account address
Returns:
Object
nodeName
:string
Supernode namenodeStatus
:uint8
Supernode registration status. 1->valid. 2->invalidbalance
:big.Int
Account balance
- Example:
# vote_getVoteDetails
Return daily SBP voting information
Parameters:
Index
: Index of days.0
stands for the first launching day
Returns:
Array<VoteDetails>
Name
:string
SBP nameBalance
:big.Int
Total number of votesAddr
:map
Map of "voting address: voting amount"
- Example: