Getting Started
Staking on the Sui network using the Staking API consists of the following main steps:
- Create a staking request.
- Sign and broadcast the transaction.
Get an authentication token to start using Staking API.
Request examples are provided using cURL.
1. Create Staking Request
Send a POST request to /api/v1/sui/[network]/staking/stake.
Example request (for testnet
network):
curl --request POST
--url 'https://api-test.p2p.org/api/v1/sui/testnet/staking/stake' \
--header 'accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"sender": "0x696f4402d7151fb49e52b629de3ce3098f3dda7721a7425c000b4f26653709e3",
"amount": 1000000000,
"gasPrice": 1000,
"gasBudget": 500000000
}'
sender
— staker account address.amount
— amount of tokens to stake in MIST (1 SUI = 10⁹ MIST).gasPrice
— price per unit of gas in MIST for processing the Sui transaction.gasBudget
— maximum gas limit for the transaction.
Example response:
{
"error": null,
"result": {
"unsignedTransaction": "0x000003000800ca9a3b00000000010100000000000000000000000000000000000000000000000000000000000000050100000000000000010020ab4fb3eeaa7b0ab4f91eedab33adf140c6750e60ca5e44b3df82491937d7bab4020200010100000000000000000000000000000000000000000000000000000000000000000000030a7375695f73797374656d11726571756573745f6164645f7374616b650003010100020000010200696f4402d7151fb49e52b629de3ce3098f3dda7721a7425c000b4f26653709e3024af02b603f7d65cced30be6ed44300d7d9d66522940e501e1a2083cfc25429e5a60bd0140000000020abca58a9797ecf7cc82596d71b4a154f8dd14b18e3190beee205b905611fbfa29c6ca3ef6b075ab6294342fe06c323768659879813e0544d3fd25a7db7875cca440000180000000020405515b0e64b00c04ebdb0517c2a1f07f3e32cba49adf4ea87d4daadc265c1f0696f4402d7151fb49e52b629de3ce3098f3dda7721a7425c000b4f26653709e3e8030000000000000065cd1d0000000000"
}
}
unsignedTransaction
— serialized unsigned transaction in the hexadecimal format. Sign the transaction and submit it to the blockchain to perform the called action.
2. Sign and Send Transaction
Use unsignedTransaction
from the previous step to sign and send the signed transaction to the Sui network.
You can check your staking position and status by sending a GET request to /api/v1/sui/[network]/transaction/stake-list/[address].
Example request (for testnet
network):
curl --request GET
--url 'https://api-test.p2p.org/api/v1/sui/testnet/transaction/stake-list/0x696f4402d7151fb49e52b629de3ce3098f3dda7721a7425c000b4f26653709e3' \
--header 'Authorization: Bearer <token>'
network
— Sui network:mainnet
ortestnet
.address
— staker account address.
Example response:
{
"error": null,
"result": {
"validatorAddress": "0xab4fb3eeaa7b0ab4f91eedab33adf140c6750e60ca5e44b3df82491937d7bab4",
"stakerAddress": "0x696f4402d7151fb49e52b629de3ce3098f3dda7721a7425c000b4f26653709e3",
"stakes": [
{
"stakeId": "0x5d920b8fca6a6043d898ab1a9a8ab167d8aa323fe2b9e76a27312f7f16e20a67",
"amount": 1000000000,
"status": "Pending"
}
]
}
}
validatorAddress
— validator address.stakerAddress
— staker account address.stakes
— detailed information on each stake:stakeId
— identifier of the stake, which is required to perform a withdrawal later.amount
— amount of tokens to stake in MIST (1 SUI = 10⁹ MIST).status
— staking transaction status:pending
— stake has been submitted and is awaiting activation. Activation may take up to 12 hours depending on validator configuration.active
— stake is active and earning rewards.unstaked
— stake has been withdrawn.
What's Next?
- Sign and Send Transaction
- Withdrawal
- Staking API reference
Updated 8 days ago