SERO : Solo Staking and Stake Node Staking

Tutorial : Staking using gero, Solo Staking and Staking Node

SERO Protocol
9 min readJul 18, 2019

--

How to start staking on gero?

The Staking feature is supported by full-node programs running v1.0.0 or above.

This article is mainly provided for users of all-node daemons. Users of interface wallets should wait for the subsequent documentation.

Staking function will be effective after the height of block 1300000

To perform Staking, you need to enable the gero exchange service. You can add --exchange --mineModetwo parameters when starting :

./gero --exchange --mineMode --datadir ~/datadir

Note: After adding these two parameters, the account balance will be re-analyzed and there will be a period of time (a few hours) during which correct balance will not be seen.

Brief description of the Staking process

  • PoS miners can buy voting shares in the voting share pool
  • Voting share pool has individual vote shares with no upper limit
  • The price of the individual shares is dynamically adjusted according to the size of the voting share pool.
  • The change in share price within the voting share pool of size 326592 is relatively balanced.
  • After the voting share pool size exceeded 326,592 the individual share prices rise sharply.
  • PoW miners will randomly select 3 shares in the voting sharing pool and broadcast the ballot information after they’ve calculated the block hash.
  • After receiving the ballot information of their own, the PoS miner immediately broadcasts the voting information with their signature.
  • After receiving the voting information of the PoS miner, the PoW miner puts the signature into the block header information.
  • If more than 2 votes are correctly voted, the PoW miner will broadcast the block and complete the block process.
  • PoS miners can choose to vote in Solo or StakingNode.
  • Each block reward is divided into PoW rewards and PoS rewards.

The ratio of PoW rewards to PoS rewards is 4 : 4

The size of PoW rewards and PoS rewards varies independently of their difficulty.

  • PoS rewards are divided into Solo voting and StakingNode voting.

The ratio of Solo staking rewards to StakeNode rewards is 3 : 4

  • Upon completion of the voting process, the rewards and collateral amount involved will be refunded within the most recent payment cycle (approximately 1 week)

Voting Share Life Cycle

SERO Voting Share Life Cycle
  • After the user chooses a certain price to purchase the shares, the collateral amount enters the locked state (Lock) and the shares enter the current voting share pool (InPool) .
  • PoW miners randomly selected 3 shares when they came out and the selected shares entered the voting state (Lottery)

Get at least two votes to complete the block process.

  • After receiving the message to be voted, the PoS miner successfully broadcasts the voting information to the PoW miner to complete the block, and the shares entered the completed state (Votted).

Shares entering the completed state will be repaid in a payment cycle (one week) and the shares will be released.

  • In the case where only two blocks of a successful vote, in addition to a share of the state to enter missed (Missed) .

As a penalty, individual shares entering the wrong state will be released after three consecutive months of lock-in.

  • Expired shares that have not been successfully selected in the stock pool expire one month later (Expire)

The principal will be released upon expiration.

StakingNode Life Cycle

SERO StakingNode Life Cycle
  • Operators can secure the right to operate StakingNode by locking in 200,000 SERO coins.
  • StakingNode can only enter the closed state after one month of operation (Close)

After the closure, new shares will not be allowed to be applied for.

At the same time, the operator is obliged to complete the existing shares in StakingNode.

  • StakingNode will return the collateral amount to the end state (Finish) when both of the following conditions are met :

All the shares of the proxy shares are released

Entering the closed state

Solo Staking

You should have a full-node program (gero) and have a certain number of SERO coins to make a solo vote and get a proportion of 3 solo staking reward.

Prerequisites for Solo Staking

1. A continuously running full-node program (gero), which has completed the block synchronously.

2. A certain amount of SERO coins in the account.( Since ticket price fluctuates, definite minimum amount of SERO to be held in account changes accordingly)

Summary of Steps : Solo Staking

1. Steps

1. Confirm that there are enough SERO coins to buy shares.

The collateral amount will also be returned when the reward is released or the share is expired

2. Create a voting account.

3. Enable automatic voting function (unlock voting account).

4. Buy shares in the Voting shares pool.

5. View current share status.

6. Confirm revenue.

Note: Be sure to back up the account key. Ordinary users can copy the keystore for backup, or export mnemonics:

> personal.exportMnemonic(sero.accounts[0])
export account mnemonic 5bEgN9YL......Xrpti4zeamkdD16C
Passphrase: 1234 // Password
"casino crys ... ... en unaware route"

You can import mnemonics like this:

> personal.importMnemonic("casino cry ... ... re route","1234")  //1234 is password

2. Confirm asset account

For safety, SERO’s asset account and voting account are separated, collateral amount and reward will only be handled by asset account and we can now confirm the asset account.

> sero.accounts[0]
"5bEgN9YLqC......4zeamkdD16C" // Account Public Key PK
> web3.fromTa(sero.getBalance(sero.accounts[0]).tkn.SERO)
10 //20 SERO Coins

3. Create a voting account

The voting account does not process assets and is only used for voting signatures.

> personal.newAccount("1234")
"2tuxyM5uL4......Ce5xNPokr"
> sero.accounts[1]
"2tuxyM5uL4......Ce5xNPokr" //Account Public Key PK

Voting accounts need to be permanently unlocked so that they can be voted quickly after being drawn.

> personal.unlockAccount(sero.accounts[1],"1234",0)

Note: Solo Staking needs to ensure that the entire node network is stable, otherwise the vote may MISS

4. View the Voting Share Pool status

  • The interfaces related to staking are in the stake object.
> stake
{
sharePoolSize: "0x0", // Current size of the shares pool
sharePrice: "0x1bc16d674ec80000", // Current share price
buyShare: function(),
closeStakePool: function(),
getShare: function(),
getSharePoolSize: function(callback),
getSharePrice: function(callback),
modifyStakePoolFee: function(),
modifyStakePoolVote: function(),
myShare: function(),
poolState: function(),
registStakePool: function(),
stakePools: function()
}

View the current Voting share pool status

> web3.fromTa(web3.toDecimal(stake.sharePrice))
"2" // The current share pool price is 2 SERO
> web3.toDecimal(stake.sharePoolSize)
0 // There are 0 shares in the current sharing pool

5. Buying shares (tickets)

  • Estimate the number of shares that can be purchased.
  • Since the share price increases linearly with the size of the pool, it is necessary to first estimate the number of shares that can be purchased.
> stake.estimateShares({
from:sero.accounts[0], //Asset Account
vote:sero.accounts[1], //Voting Acccount
value:web3.toTa(20) //Total amount that can be staked
})
{
avPrice: "0x1bc6ab6c2dfe1734", //平均股份价格
basePrice: "0x1bc16d674ec80000", //基础股份价格
total: "0x9" //可购买数量
}

Subscription,from: Asset account, vote: voting account, value: subscription fund

>   stake.buyShare({from:sero.accounts[0],vote:sero.accounts[1],value:web3.toTa(20)})
"0xac137baf4cd195....17c1fcb3edae4d25"
> sero.getTransactionReceipt("0xac137baf4....cb3edae4d25")
{
....
poolId: null,
shareId: "0xb5b01116f......71015afc6f", //ID of Purchased shares
....
}

Check the status of the shares purchased

> stake.getShare("0xb5b01116f......71015afc6f")
{
addr: "5bEgN9YLq......4zeamkdD16C",
id: "0xb5b01116f3e8......2a08b28171015afc6f", //ID of Purchased
missed: 0,
num: 1,
price: 2001844456911510800, //The average price
returnAmount: 20814755655292090000, //Amount refunded
status: 0,
total: 9, //Number of shares
tx: "0x47a87164f......13e422efee",
voteAddr: "2tuxyM5uL4ZDk......4xdTPCe5xNPokr" //Collection code of voting account
}

View my total shares

> stake.myShare("5bEgN9YLqCBN9......pti4zeamkdD16C")
[{
addr: "5bEgN9YLqCB......rpti4zeamkdD16C",
expired: 0, //Number of expired shares
missed: 0, //Vote miss number
pools: null,
remaining: 10, //The remaining number of shares
shareIds: [ //List of shares IDs I own
"0x3f2ae......a0c656d9b7b7",
"0x58395b1......cfa4141d",
"0xb5b011......171015afc6f"
],
total: 30, //My total number of shares
voteAddr: ["2tuxyM5uL4ZDkfp......Vtw4xdTPCe5xNPokr"] //My Vote ID
}]

6. View Account Balance

> web3.fromTa(sero.getBalance(sero.accounts[0]).tkn.SERO)   //Asset Account
339.980079865355683522
> sero.getBalance(sero.accounts[1]) //Voting Account
{}

How to create a Staking Node

Due to unstable personal network or unable to run the full-node continuously, it is possible to entrust Staking Node to vote.

Here’s how to create a Staking Node for voting :

Prerequisites for creating a SERO Staking Node

1. Have a continuous online full-node program (gero).

2. Have an account with a 200,000 SERO balance (Collateral Amount).

3. Have a good network environment.

Steps for creating a StakingNode

1. Summary of Steps

1. Confirm that there are 200,000 SERO coins being used for pledge.

When the Node is closed, the collateral amount will be returned.

2. Create a proxy voting account.

3. Turn on the automatic voting function (unlock the voting account).

4. Pledge SERO coins to open Staking Node

5. View the current node delegation status.

6. Confirm revenue.

2. Confirm asset account

> sero.accounts[0]
"5bEgN9YLqC......4zeamkdD16C"
> web3.fromTa(sero.getBalance(sero.accounts[0]).tkn.SERO)
200000.980079865355683522

3. Create a proxy voting account

> personal.newAccount("1234")
"2tuxyM5uL4......w4xdTPCe5xNPokr"
> sero.accounts[1]
"2tuxyM5uL4......Ce5xNPokr"

4. Enable automatic voting function (unlock the voting account)

Voting accounts need to be permanently unlocked so that they can be voted quickly after being drawn.

> personal.unlockAccount(sero.accounts[1],"1234",0)

Note: StakingNode needs to ensure that the entire node network is stable, otherwise it may lead to voting MISS, and the vote of MISS may lead to an increase in the collateral amount locking time of StakingNode.

5. Register Staking Node by pledging SERO coins

The client needs to connect more than 10 peers to open the command to register the staking node.

> admin.peers.length
15

Start registration StakingNode, note that in this example accounts[0]has 200,000 SERO coins, which is a asset account.

> stake.registStakePool({
from:sero.accounts[0], //Asset Account
vote:sero.accounts[1], //Voting Acccount
value:web3.toTa(200000), //Registered fund
fee:web3.toHex(2500) //Draw: the highest 7500 represents 75%, and the lowest 2500 represents 25%
})
"0xecb3b5b235....8d35d7d1651" //Register generated transaction hash

You can view the IDof the registered StakingNode by viewing the transaction receipt.

> sero.getTransactionReceipt("0xecb3b5b....7d1651")
{
......
poolId: "0xb1e20b74......2b35888176d", //StakingNode ID
shareId: null,
......
}

Note: TheStakingNode pledge of the collateral amount needs to be locked for 1 month before it can be unlocked but it must be closed after closing the staking node and no shares should point to the staking node.

6. View current node delegation status and revenue

The status of StakingNode can be viewed via poolState method.

> stake.poolState("0xb1e20b......88176d")
{
choicedNum: "0x0", //Number of shares selected
closed: false, //Is Staking Node closed ?
createAt: "0x11", //Staking Node created time
expireNum: "0x0", //Number of entrusted shares expired of Staking Node
fee: "0xfa0", //Withdrawal of Staking Node
id: "0xb1e20b7......88176d", //Staking Node ID
idPkr: "2E7uXmU9......GeQyGBzSvWE",
lastPayTime: "0x0", //Lastest payment time
missedNum: "0x0", //Missed Votes
own: "5bEgN9YLqC......4zeamkdD16C",
shareNum: "0x0", //Total number of shares
tx: "0xecb3b5b......d1651",
voteAddress: "2tuxyM5uL4......w4xdTPCe5xNPokr",
wishVoteNum: "0x0",
profit: "0x100"
}

How to select Staking Node to vote for yourself

Ordinary users only need to specify the Staking Node when they purchase the shares, so they can enjoy the convenient voting service without deploying the full-node program.

1. Query the Staking Node list of the whole network

> stake.stakePools()
[{
choicedNum: "0x0", //Number of shares selected
closed: false, //Whether to be closed
createAt: "0x0",
expireNum: "0x0", //Number of expired shares
fee: "0xfa0", //Draw Proportion
id: "0xb1e20b7......2b35888176d", //StakingNode ID
idPkr: "2E7uXm......yGBzSvWE",
lastPayTime: "0x0",
missedNum: "0x0", //Missed Votes
own: "4ujQrFsaYq......WZzxtnqgTsL",
shareNum: "0x0", //Number of votes
tx: "0xecb3b5b......35d7d1651",
voteAddress: "21F6gyEUw......zMZ5VtGL2",
wishVoteNum: "0x0"
}, {
choicedNum: "0xac",
closed: false,
createAt: "0x0",
expireNum: "0x30d",
fee: "0x123b",
id: "0xc48e455......2af708a",
idPkr: "2WCHu3......jbFrXWE",
lastPayTime: "0x12b404",
missedNum: "0x60",
own: "2WCHu3bM......jbFrXWE",
shareNum: "0x4fe",
tx: "0xb9a0a......dc0212",
voteAddress: "JyRPyD8n......bucfZbRH",
wishVoteNum: "0x0"
}]

2. Choose to vote for Staking Node when purchasing shares.

> stake.buyShare({
from:sero.accounts[0],
vote:sero.accounts[0],
pool:"0xc48e45......af708a", //Select StakingNode ID
value:web3.toTa(2000)
})
"0xb524ec5......b8d511b0b"

> sero.getTransactionReceipt("0xb524e......8d511b0b")
{
......
shareId: "0x9e415fa4......94e4eef", //Share ID Purchased
......
}

3. Status of Staking Node confirming a share.

> stake.getShare("0x9e415f......94e4eef")
{
addr: "4ujQrFsaY......zxtnqgTsL",
id: "0x9e415f......994e4eef",
missed: 0,
num: 723,
pool: "0xc48e4557......ec62af708a", //StakingNode ID selected by this share
price: 2739073884442371600,
returnAmount: 23602264528913793000, //Income
status: 0,
total: 730,
tx: "0xb524ec5......b8d511b0b",
voteAddr: "4ujQrFsaYq......qWZzxtnqgTsL"
}

Return of Collateral Amount

Staking’s design will not confiscate or destroy the collateral of any user.

  • · When the following conditions happen, the collateral amount of the shares will be returned

The shares that complete the voting process will be returned at the same time as the block award is given.

If the shares have not been selected by any miners for more than one month, the collateral amount will be refunded.

Shares that were selected but did not respond(MISS) will be returned in the third month.

  • When the following conditions are all met, the StakingNode collateral amount will be returned.

StakingNode is closed by the owner

StakingNode registration completed for one month

There are no more shares in the shares pool entrusted to StakingNode

Official links

Official website : https://sero.cash
Tencent : https://v.qq.com/x/page/s0792e921ok.html
YouTube : https://youtu.be/UNG2boG49Io
Twitter : https://twitter.com/SEROdotCASH
Medium : https://medium.com/@SERO.CASH
Github : https://github.com/sero-cash
Reddit : https://www.reddit.com/user/SEROofficial
BitcoinTalk ANN : https://bitcointalk.org/index.php?topic=5123382.0
Linkedin :https://www.linkedin.com/company/sero-global-inc/
Facebook : https://www.facebook.com/SEROProtocol
Gitter Community : https://gitter.im/sero-cash/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link
SERO VS Zcash encryption speed comparison :https://www.youtube.com/watch?v=bc6yHTLSl5M

Telegram Community

Chinese group : https://t.me/SeroOfficialChs
English group : https://t.me/SeroOfficial
SERO Announcement : https://t.me/SEROannouncements
SERO Official Technical Support : https://t.me/SeroFans

SERO Discord : https://discord.gg/3AZVMRU

--

--

SERO Protocol
SERO Protocol

Written by SERO Protocol

World’s first Zero-Knowledge Proof based Privacy Protection platform for decentralised applications which supports smart contract and uses SuperZK protocol.

No responses yet