Skip to content

Staking

dustinxie edited this page Oct 20, 2020 · 6 revisions

This wiki is still in progress.

Staking

This wiki is about the development details of staking. please refer to http://docs.iotex.io/docs/ioctl.html#stake-vote for how to use ioctl to stake.

Buckets

A bucket is a collection of IOTX used in stake. Any bucket has the following properties

1. ID (int >= 0, auto increased)
2. Owner (the owner of the bucket)
3. delegate name (whom the IOTX is staked to)
4. duration (in days, 0<=duration<=1050, how many days the bucket is staked for)
5. Auto-stake (On/Off, if the stake duration stay the same or not)

Bucket information can be easily found by using ioctl bc bucket $n.

A bucket has three possible status

1. Staked (Display as Ongoing)
2. Unstaked (user needs to submit unstake request after stake duration is over for it to succeed, i.e., block.Timestamp > bucket.StakeStartTime + bucket.StakedDuration. Upon success, bucket.UnstakeStartTime = block.Timestamp)
3. Ready to withdraw (3 days after successful unstaking a bucket, IOTX in the bucket can be withdrawn, i.e., block.Timestamp > bucket.UnstakeStartTime + 3 days)

Also, a bucket is Burndrop eligible if it meets

Duration >= 91 days and Auto-stake is On

New Stake (create a bucket)

A bucket is created by submitting an action StakeCreate.

Edit Bucket

A bucket can be edited with the following actions

Change Delegate

Change whom the bucket is staked for.

Requirement

Bucket status is staked

Add Stake

Add new IOTX to the bucket. "Add Stake" for bucket with "Auto-Stake" is on.

Requirement

Bucket status is staked and auto-stake is on.

Restake

Change duration and Auto-Stake status. Duration can only be increased.

Requirement

Bucket status is staked.

Unstake

Request to unstake the IOTX from bucket. After 3 days of unstaking start time, the bucket becomes "ready to withdraw.

Requirement

Bucket status is staked. Bucket status is not auto-staked.

Withdraw

Request to withdraw IOTX from a bucket. The bucket will be destroyed.

Requirement

Bucket status should be in unstaking and unstaking start time + 3 days <= today.

Reassign

Change the owner of the bucket to someone else. The current owner will lose the bucket.

Warning

This action will change the owner of the bucket. Reassign can be done anytime.

Destroy a bucket

After the IOTX of a bucket is withdrawn, the bucket is destroyed automatically.