How to Use the BNB Staking API

Typical user journeys with the BNB Staking API.

This guide provides instructions on using the BNB Staking API to stake, deactivate, and restake BNB tokens on the Binance Beacon Chain.

📘

Info:

Note that plan_id is an optional field for all request. If it's not specified, the staking API will generate transactions for the default validator address.

Users should hold the BNB tokens on the Binance Beacon Chain. If the user has BNB solely on the Binance Smart Chain (BSC), they can facilitate a cross-chain transfer to relocate their assets onto the Binance Beacon Chain.

How to Stake

Staking on the BNB mainnet and testnet (Beacon Chain) is initiated through the Post Stake Intent endpoint. The endpoint returns an unsigned transaction that must be signed and broadcasted to the network by the private key corresponding to the public key provided in the stake intent.

Here's an example request for staking on BNB:

curl --location --request POST '<https://svc.blockdaemon.com/boss/v1/binance/mainnet/stake-intents'>  
--header 'Content-Type: application/json'  
--header 'Accept: application/json'  
--header 'X-Client-ID: 3bcf0d33-cb48'  
--header 'X-API-Key: local-key'  
--data-raw '{  
      "amount": "100000000",  
      "delegator_address": "bnb1ecusp9zcchwslnvwdguukurad93t5duf68lpll"  
      "plan_id": "39da1735-9580-449d-b665-846339054beb  
}'

This is what a typical response will look like:

{  
    "binance": {  
      "amount": "100000000",  
      "delegator_address": "bnb1ecusp9zcchwslnvwdguukurad93t5duf68lpll",  
      "unsigned_transaction": "7b226163636f756e745f6e756d626572223a223430222c22636861696e5f6964223a22636861696e2d4f7458753275222c2264617461223a6e756c6c2c226d656d6f223a22222c226d736773223a5b7b2274797065223a22636f736d6f732d73646b2f4d736753696465436861696e44656c6567617465222c2276616c7565223a7b2264656c65676174696f6e223a7b22616d6f756e74223a22313030303030303030222c2264656e6f6d223a22424e42227d2c2264656c656761746f725f61646472223a22626e62316563757370397a63636877736c6e7677646775756b757261643933743564756636386c706c6c222c22736964655f636861696e5f6964223a22627363222c2276616c696461746f725f61646472223a226276613136736a75366b786a637a377378613267336b66366b70337a767a66346738346a77736e38336e227d7d5d2c2273657175656e6365223a2230222c22736f75726365223a2230227d",  
      "validator_address": "bva16sju6kxjcz7sxa2g3kf6kp3zvzf4g84jwsn83n"  
    },  
    "customer_id": "3bcf0d33-cb48",  
    "network": "mainnet",  
    "protocol": "binance",  
    "stake_intent_id": "c7d2ad49-a822-41bc-9701-eed690ac217b"  
  }

👍

Note:

Your stake activates right after submitting the staking transaction. After you send the delegate transaction, you will receive your first staking rewards at T+3 UTC 00:00. Then, you get rewards every day at UTC 00:00.

How to Deactivate a Stake

Deactivating your stake from the validator is initiated through the Post Deactivation Intent endpoint. The endpoint returns an unsigned transaction that the private key of the delegator must sign.

Here's a request example:

curl --location --request POST '<https://svc.blockdaemon.com/boss/v1/binance/mainnet/deactivation-intents'>  
--header 'Content-Type: application/json'  
--header 'Accept: application/json'  
--header 'X-Client-ID: 3bcf0d33-cb48'  
--header 'X-API-Key: local-key'  
--data-raw '{  
      "amount": "100000000",  
      "delegator_address": "bnb17rrfal2czd6vgnkt8veqmrdngpr57l3yqdnptw"  
      "plan_id": "32e4adb0-38fe-4e07-9eb6-aefa3543a24d"

}'

It will return the following response:

{  
    "binance": {  
      "amount": "100000000",  
      "delegator_address": "bnb17rrfal2czd6vgnkt8veqmrdngpr57l3yqdnptw",  
      "unsigned_transaction": "7b226163636f756e745f6e756d626572223a223734222c22636861696e5f6964223a22636861696e2d4f7458753275222c2264617461223a6e756c6c2c226d656d6f223a22222c226d736773223a5b7b2274797065223a22636f736d6f732d73646b2f4d736753696465436861696e556e64656c6567617465222c2276616c7565223a7b22616d6f756e74223a7b22616d6f756e74223a22313030303030303030222c2264656e6f6d223a22424e42227d2c2264656c656761746f725f61646472223a22626e623137727266616c32637a643676676e6b74387665716d72646e67707235376c337971646e707477222c22736964655f636861696e5f6964223a22627363222c2276616c696461746f725f61646472223a226276613136736a75366b786a637a377378613267336b66366b70337a767a66346738346a77736e38336e227d7d5d2c2273657175656e6365223a2231222c22736f75726365223a2230227d",  
      "validator_address": "bva16sju6kxjcz7sxa2g3kf6kp3zvzf4g84jwsn83n"  
    },  
    "customer_id": "3bcf0d33-cb48",  
    "deactivate_intent_id": "1e6803a7-a3c3-472c-8fbe-43c3c4a8f2c8",  
    "network": "mainnet",  
    "protocol": "binance"  
  }

👍

Note:

After you sent undelegate transaction, your staked BNB won't receive rewards starting from the next UTC 00:00. You'll receive your BNB seven days after the transaction is submitted (from the next UTC 00:00).

How to Restake

Restake on the BNB mainnet and testnet (Beacon Chain) is initiated through the Post Restake Intent endpoint. In the process, you'll be working with transactions that include hex-encoded byte strings with a signature applied, make sure to prepare an object ready for direct submission to the network.

Additionally, you can move your staked BNB to a different validator by initiating a redelegate transaction. Your BNB stays staked, and rewards from validator B can be received starting the next 00:00 UTC.

Here's an example request:

curl --location --request POST '<https://svc.blockdaemon.com/boss/v1/binance/mainnet/restake-intents'>  
--header 'Content-Type: application/json'  
--header 'Accept: application/json'  
--header 'X-Client-ID: 3bcf0d33-cb48'  
--header 'X-API-Key: local-key'  
--data-raw '{  
    "amount": "100000000",  
    "delegator_address": "bnb1sr79hzsptul49r0m53lam2jrejlxwydddwuwhv",  
    "old_validator_address": "bva1mpu54zwmmw7lg5h8yaqkxsptcx3ekzckvkmy6m",  
    "plan_id": "9d550917-c814-4ae4-aee2-22856c536e6c"  
}'

It will return the following response:

{  
    "binance": {  
      "amount": "100000000",  
      "delegator_address": "bnb1sr79hzsptul49r0m53lam2jrejlxwydddwuwhv",  
      "new_validator_address": "bva16sju6kxjcz7sxa2g3kf6kp3zvzf4g84jwsn83n",  
      "old_validator_address": "bva1mpu54zwmmw7lg5h8yaqkxsptcx3ekzckvkmy6m",  
      "unsigned_transaction": "7b226163636f756e745f6e756d626572223a223334222c22636861696e5f6964223a22636861696e2d4f7458753275222c2264617461223a6e756c6c2c226d656d6f223a22222c226d736773223a5b7b2274797065223a22636f736d6f732d73646b2f4d736753696465436861696e526564656c6567617465222c2276616c7565223a7b22616d6f756e74223a7b22616d6f756e74223a22313030303030303030222c2264656e6f6d223a22424e42227d2c2264656c656761746f725f61646472223a22626e623173723739687a737074756c343972306d35336c616d326a72656a6c7877796464647775776876222c22736964655f636861696e5f6964223a22627363222c2276616c696461746f725f6473745f61646472223a226276613136736a75366b786a637a377378613267336b66366b70337a767a66346738346a77736e38336e222c2276616c696461746f725f7372635f61646472223a22627661316d707535347a776d6d77376c673568387961716b78737074637833656b7a636b766b6d79366d227d7d5d2c2273657175656e6365223a2232222c22736f75726365223a2230227d"  
    },  
    "customer_id": "3bcf0d33-cb48",  
    "network": "mainnet",  
    "protocol": "binance",  
    "restake_intent_id": "eeb74f1e-aff4-4cba-a922-e052c8b68c99"  
  }

Example Code

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.