For Developers
Development Details
Binance Liquid Staking

BNB staking mechanics

BNB Liquid Staking lets the user stake their funds through the corresponding smart contracts on the Binance network, accumulate rewards, and receive their stake and rewards when unstaking.

The following section explains staking requirements, fees, rewards, validators, smart contracts and function calls to interact with these smart contracts.

Requirements

The requirements when staking are:

  • Minimum value to stake — 0.502 BNB (the 0.002 part is the relayer fee added on top of 0.5 BNB).

  • Maximum value to stake — unlimited, at the user’s discretion.

The requirements when unstaking are:

  • Minimum value to unstake — 0.5 BNB.
  • Maximum value to unstake — up to the initial stake for ankrBNB.
  • Unbond time (before user gets their unstaked funds) — 7–15 days.
  • Splitting large unstaked amounts between several unbond times due to limited nodes capacities.

Fees

  • Ankr takes 10% fee from the staking reward.

  • When staking, the user pays the relayer fee — 0.002 BNB, which is a fee for transferring assets between BNB Chain (prev. Binance Chain) and BNB Beacon Chain (prev. Binance Chain).

  • When unstaking, the user pays nothing, while Ankr pays:

    • Unbonding transaction fee (undelegate_fee) — 0.004 BNB.

    • Cross-chain transaction fee (transfer_out_fee) — 0.000075 BNB.

The user must also count in the gas price for outgoing transactions.

Rewards

Validators receive rewards every day, at midnight, UTC.

The APY is calculated from the validators' rewards.

The rewards the user gets are calculated using the exchange ratio explained later in this document.

To understand BNB Liquid Staking, you need to know the entities and understand the workflow under the hood.

The following entities are involved:

  • Smart contracts
  • Ankr addresses
  • Ankr validators

Smart contracts

Smart contracts and addresses involved in BNB Liquid Staking are:

Validators

Staking workflow

  1. User sends a request to the BinancePool::stake({value:stake+relayer_fee}) on BNB Chain. stake specifies the staked amount and should meet the requirements described above, while fee specifies the fee deducted from the user’s wallet for the staking.
  2. BinancePool verifies the request checking the minimal_stake_value and the user-paid relayer_fee, executes TokenHub::transferOut() to make a cross-chain transaction to Binance Chain, mints ankrBNB in the amount defined by the current exchange ratio, and then issues a Staked() event with the sender, stake, intermediary parameters.
  3. BNB backend service detects the issued Staked() event and creates a record in its Postgres database, then waits for the successful cross-chain transaction completion to Binance Chain, which usually takes around 45s.
  4. Upon transaction completion, the staked amount ends up at intermediaryAddress — the BNB backend service address on Binance Chain. Then the BNB backend service executes sendDelegation(validatorAddress, stake) on Binance Chain to send the stake to validatorAddressof one of the validators from the Ankr set.

Exchange ratio

When staking, the user receives:

  • ankrBNB in the amount calculated the following way: user's_stake * exchange_ratio.

When unstaking, the user receives their_stake + accumulated_rewards in BNB. It is calculated by the following formula: accumulated_amount_ankrBNB / exchange ratio.

The exchange ratio is calculated by the following formula:

uint256 totalShares = totalSharesSupply(); == ankrBNB.totalSupply();
uint256 denominator = _totalStaked + totalRewards - _totalUnbondedBonds;
_ratio = (totalShares * 1e18) / denominator;

Unstaking workflow

  1. For ankrBNB, the user sends a request to the ankrBNB::approve(aBNBb.address, amount) to let the aBNBb smart contract transfer the user's Liquid Staking tokens.
  2. User sends a request to the BinancePool::unstake(amount) on BNB Chain. amount specifies the amount to be released back to the user.
  3. BinancePool verifies the request checking the minimal_stake_value and balance_of_user, then executes aBNBb::lockSharesFor() to transfer ankrBNB from user to the aBNBb smart contract address (input amount) then aBNBb::burn() executes to decrease total supply of tokens.
  4. BNB backend service detects the UnstakePending() event and creates a record in Postgres database, then starts to check the database for new Unstake requests every day at 00:00. If it finds a new Unstake request, it executes sideChainUnbond(bsc, validatorAddress, totalPendingAmount) on the Binance Chain where totalPendingAmount specifies the aggregate pending amount to unstake for different users and validatorAddress specifies the address of one of the validators from the Ankr set to get totalPendingAmount from.
  5. After the UnbondTime, intermediaryAddress receives undelegated(unbonded) funds. Then the BNB backend service makes a cross-chain transaction to operatorAddress on BNB Chain.
  6. Upon the cross-transaction completion, the unstaked amount ends up at operatorAddress. Then the BNB backend service executes BinancePool::distributeRewards({value: totalPendingAmount}) on BNB Chain to distribute stakes and rewards to the users.

The unstake process

To understand the Step 4 through 6 clearer, look at the following description.

  1. Ankr accumulated all the unstaking transaction from Liquid Staking users in a pool.
  2. Once every 24 hours, Ankr check if there is a validator that doesn't have a pending unstaking transaction.
  3. If such validator is found, Ankr sends an unstaking transaction to it. The amount in this transaction is an aggregate of all the total users unstaking transactions since the last Ankr unstaking transaction.
  4. The transaction takes 7 days to be processes, which is the BNB Chain unbond time period.
  5. After the unbond time period ends, Ankr receives the unstaked funds and redistributes them to the users.

Additional information

Additional details To get more information about staking on Binance, read Staking (opens in a new tab), Delegating (opens in a new tab), and Binance cross-chain transfer (opens in a new tab).

To get more information about unstaking on Binance, read Unbond (opens in a new tab) and Binance cross-chain transfer (opens in a new tab).