# Staking
Staking provides functions such as stake TOP for votes, voting, and claim voting dividends, etc. The specific commands are shown in the following table.
Command | Description |
---|---|
topio staking stakeFund | Stake TOP for votes. |
topio staking withdrawFund | Withdraw TOP for votes. |
topio staking voteMiner | Vote for advance miners. |
topio staking withdrawVotes | Withdraw votes. |
topio staking queryVotes | Query the information of the accounts used votes. |
topio staking queryReward | Query voters dividend. |
topio staking claimReward | Claim voters dividend. |
# Stake TOP For Votes
Rules for exchanging votes:
locked TOP token=votes_amount / [ 1.04^(lock_duration / 30 - 1) ], lock_duration < 570;
locked TOP token=vote_amount / 2, lock_duration >= 570.
The longer the lock duration is, the fewer TOP tokens are locked for the same number of votes.
Request
topio staking stakeFund
Request Parameters
Parameter Name | Required | Default Value | Parameter Type | Description |
---|---|---|---|---|
vote_amount | Yes | - | Uint 64 | Amount of votes to be exchanged. |
lock_duration | Yes | - | Uint 16 | TOP token lock duration. The the unit is "day". The lock duration must be at least 30 days and must be an integer multiple of 30. |
Options
Option Name | Default Value | Description | |
---|---|---|---|
-h, --help | - | - | Check the command's help information. |
Response Parameters
Parameter Name | Type | Description |
---|---|---|
Transaction hash | String | The transaction hash that can be used to query the transaction consensus status. |
Request Sample
Redeem 10,000 tickets, the lock-up period is 30 days.
topio staking stakeFund 10000 30
Response Sample
- Successful
Transaction hash: 0x14a3301e093d27e351b4cfe036456419830d4f43ba6938fe91e6641b1c8e90aa
Please use command 'topio querytx' to query transaction status later on!!!
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is "success", execute topio chain queryAccount
to query the account's unused vote, if it has corresponding change, then the stake is a success.
- Failed
Transaction hash: 0x3eadada0895b86aa502627f89406d07f085681381648aa1479fbc5f183dc93ea
Please use command 'topio querytx' to query transaction status later on!!!
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is "failure", execute topio chain queryAccount
to query the account's unused vote, if it does not have any changes, then the stake is a failure.
# Withdraw TOP For Votes
During the lock-up period, the TOP tokens cannot be withdrawn, only the TOP tokens at its expiry can be withdrawn.
The locked TOP token corresponding to the used votes cannot be withdrawn.
After the withdrawn is initiated, the withdrawn amount will be credited immediately.
Withdraw rules:
When redeeming votes, the system will generate an order for each redemption transaction. Record the redemption quantity, TOP and lock-up period in the order to determine the redemption ratio of this transaction. Then withdraw TOP according to the redemption ratio of the transaction at that time.
Request
topio staking withdrawFund
Request Parameters
Parameters Name | Required | Default Value | Parameter Type | Description |
---|---|---|---|---|
votes_num | Yes | - | String | Votes amount, withdraw the corresponding TOP token. |
Options
Option Name | Default Value | Description | |
---|---|---|---|
-h, --help | - | - | Check the command's help information. |
Response Parameters
Parameter Name | Type | Description |
---|---|---|
Transaction hash | String | The transaction hash that can be used to query the transaction consensus status. |
Request Sample
topio staking withdrawFund 200
Response Sample
- Successful
Transaction hash: 0x6e74dd5860873cd9bf0dc14f5312aac93bcbbec2a92372c783fffb7fc1f7c902
Please use command 'topio querytx' to query transaction status later on!!!
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is a "success", execute topio chain queryAccount
to query the account's balance and unused vote amount, have corresponding changes, then succeed to withdraw TOP tokens.
- Failed
Transaction hash: 0x68c925994cb066d11ed946f7e6ef8ec5e62f3554ac7370c82442f8e8b5d067ed
Please use command 'topio querytx' to query transaction status later on!!!
# Vote For Advance Miners
Please make sure that you have enough unused votes in your account before voting. You can use the topio chain queryAccount
command to query. If you do not have enough votes in your account, you can exchange votes by command topio staking stakeFund
.
Accounts on the block chain can vote for advance nodes to obtain dividend:
A single account currently allows up to 1,000 miners to vote;
After voting for miners, part of the rewards obtained by miners will be distributed to voters.
Request
topio staking voteMiner
Request Parameters
Parameter Name | Required | Default Value | Type | Description |
---|---|---|---|---|
miner_and_votes | Yes | - | String, Int | Accepted voting miner account address, number of votes |
Options
Option Name | Default Value | Description | |
---|---|---|---|
-h, --help | - | - | Check the command's help information. |
Response Parameters
Parameter Name | Type | Description |
---|---|---|
Transaction hash | String | The transaction hash that can be used to query the transaction consensus status. |
Request Sample
topio staking voteMiner T800002276a7d58218ac4978733e5cca927a7d86cb7c87 200 T8000066ab344963eaa071f9636faac26b0d1a39900325 300
Response Sample
- Successful
Transaction hash: 0x2330f8d417bd6c51770df492272f5e9669717ec25a915d3d379e0ed52e462d07
Please use command 'topio querytx' to query transaction status later on!!!
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is a "success", execute topio chain queryAccount
to query account unused vote amount, has corresponding change, succeed to vote for miners.
- Failed
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is a "failure", then failed to vote for miners.
# Withdraw Votes
A voter may withdraw votes at any time that has already been vote for miners.
The number of votes for each withdrawn operation is unlimited, but cannot exceed the total number of votes vote for the miners, otherwise the withdraw operation will fail.
After voting for the miner, even if the miner is unregistered, the votes will not be returned to your account. You need to initiate the withdrawn operation.
You can cancel voting for miners in bulk.
Request
topio staking withdrawVotes
Request Parameters
Parameter Name | Required | Default Value | Type | Description |
---|---|---|---|---|
miner_and_votes | Yes | - | String, Int | Accepted voting miner account address, number of votes |
Options
Option Name | Default Value | Description | |
---|---|---|---|
-h, --help | - | - | Check the command's help information. |
Response Parameters
Parameter Name | Type | Description |
---|---|---|
Transaction hash | String | The transaction hash that can be used to query the transaction consensus status. |
Request Sample
topio staking withdrawVotes T800002276a7d58218ac4978733e5cca927a7d86cb7c87 100
Response Sample
- Successful
Transaction hash: 0xb740183a59398241ecf709d9003f607bb6dde40441b106d9edd795fde0da1208
Please use command 'topio querytx' to query transaction status later on!!!
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is a "success", execute topio chain queryAccount
to query account unused vote amount, has corresponding change, then succeed to withdraw votes.
- Failed
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is a "failure", then failed to withdraw votes.
# Query Votes
Support to query the information of the account‘s used votes. Including the miner receiving the vote and the number of votes.
Request
topio staking queryVotes
Request Parameters
Parameter Name | Required | Default Value | Type | Description |
---|---|---|---|---|
account_addr | No | The default account. | String | The voter account address. If not specified, query the voting distribution information of the default account. |
Options
Option Name | Default Value | Description | |
---|---|---|---|
-h, --help | - | - | Check the command's help information. |
Response Parameters
Parameter Name | Type | Description |
---|---|---|
vote_infos | Map array | Accepted voting miner account address, number of votes |
Request Sample
topio staking queryVotes T800002276a7d58218ac4978733e5cca927a7d86cb7c87
Response Sample
- Successful
{
"data" : {
"vote_infos" : {
"T8000066ab344963eaa071f9636faac26b0d1a39900325" : 200
}
},
"errmsg" : "ok",
"errno" : 0,
"sequence_id" : "80"
}
- Failed
No data!
# Query Reward
After you vote for the miners, you can get the corresponding voting dividend, and the dividend ratio is set by the miners being voted.
Voter dividend is not immediately searchable and can be queried 12 hours after voting.
Request
topio staking queryReward
Request Parameters
Parameter Name | Required | Default Value | Type | Description |
---|---|---|---|---|
account_addr | Yes | - | String | Voter account address. If not specified, query the default account's voter dividend. |
Options
Option Name | Default Value | Description | |
---|---|---|---|
-h, --help | - | - | Check the command's help information. |
Response Parameters
Parameter Name | Type | Description | |
---|---|---|---|
accumulated | Uint64 | The integer part of the voter’s total dividend, in uTOP. | |
accumulated_decimals | Uint32 | The decimal part of the voter’s total dividend, in uTOP. | |
issue_time | Uint64 | Clock height when the voter's dividend is issued. | |
last_claim_time | Uint64 | Clock height when the last time to claim voter dividend. | |
node_dividend | List | Dividend information of the miner being voted. | |
account_addr | String | Account address of the miner being voted. | |
accumulated | Uint64 | The integer part of the dividend given to the voter by the miner be voted. The unit is uTOP. | |
accumulated_decimals | Uint32 | The decimal part of the dividend given to the voter by the miner be voted. The unit is uTOP. | |
issue_time | Uint64 | The time when the voted miner issues dividend to the voter. | |
last_claim_time | Uint64 | The clock height at which the voted miner’s dividend was received last time. | |
unclaimed | Uint64 | The integer part of the dividend issued by the miner that the voters has not claimed, in uTOP. | |
unclaimed_decimals | Uint32 | The decimal part of the dividend issued by the miner that the voters has not claimed, in uTOP. | |
unclaimed | Uint64 | The integer part of the dividend that the voters has not claimed, in uTOP. | |
unclaimed_decimals | Uint32 | The decimal part of the dividend that the voters has not claimed, in uTOP. |
Request Sample
topio staking queryReward T800002276a7d58218ac4978733e5cca927a7d86cb7c87
Response Sample
- Successful
{
"data" : {
"accumulated" : 6994245799976,
"accumulated_decimals" : 419004,
"issue_time" : 3535500,
"last_claim_time" : 0,
"node_dividend" : [
{
"account_addr" : "T800002276a7d58218ac4978733e5cca927a7d86cb7c87",
"accumulated" : 6994245799976,
"accumulated_decimals" : 419004,
"issue_time" : 3535500,
"last_claim_time" : 0,
"unclaimed" : 6994245799976,
"unclaimed_decimals" : 419004
}
],
"unclaimed" : 6994245799976,
"unclaimed_decimals" : 419004
},
"errmsg" : "OK",
"errno" : 0,
"sequence_id" : "1"
}
- Failed
No data!
# Claim Reward
The system will settle voter dividends every 12 hours and automatically distribute voter dividends to the dividend pool.
The voter can apply for withdrawal once within 12 hours, and the withdrawal will be received immediately after the application is initiated.
Request
topio staking claimReward
Request Parameters
None.
Options
Option Name | Default Value | Description | |
---|---|---|---|
-h, --help | - | - | Check the command's help information. |
Response Parameters
Parameter Name | Type | Description |
---|---|---|
Transaction hash | String | The transaction hash that can be used to query the transaction consensus status. |
Request Sample
topio staking claimReward
Response Sample
- Successful
Transaction hash: 0x591c0f2fdc3a6e189bedefbe21e965c2aa7bfec70e31a0660fe2a00e02edea07
Please use command 'topio querytx' to query transaction status later on!!!
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is a "success", execute topio chain queryAccount
to query account balance, has corresponding change, then succeed to claim reward.
- Failed
Execute topio querytx
to query the transaction by transaction hash, when the consensus final status is a "failure", then failed to claim reward.