Sign and Broadcast Transaction
To complete any staking or withdrawal operation on Sui, sign the unsigned transaction provided by the Staking API and broadcast it to the network.
1. Prepare the transaction
Retrieve an unsigned serialized transaction from the relevant API endpoint, e.g., staking/stake or staking/withdraw.
2. Sign the transaction
Use the P2P Signer SDK to sign the unsigned data following protocol specific configuration.
3. Send the transaction
Broadcast the signed transaction to the Sui network by sending a POST request to /api/v1/sui/{network}/transaction/send.
Example request (for testnet network):
curl --request POST \
--url https://api-test.p2p.org/api/v1/sui/testnet/transaction/send \
--header 'accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'content-type: application/json' \
--data '
{
"transaction": "0x1f2e3d4c5b6a7e8f9a0b1c2d3e4f5g6h7i8j9k0l1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6b7c8d9e0f1g2h3i4j5k6l7m8n9o0p",
"signature": "0x696f4402d7151fb49e52b629de3ce3098f3dda7721a7425c000b4f26653709e3"
}
'signedTransaction— signed transaction in the hexadecimal format which needs to be broadcasted to the network.signature— signature of the staker account address.
Example response:
{
"error": null,
"result": {
"transactionDigest": "DiXajfAeTLVhiQZuW8aH2UD1XsCEoZVH4twRC5PjeK5"
}
}transactionDigest— hash of the transaction.
Use the transactionDigest object to check the transaction status via explorer, e.g., example of the broadcasted transaction.
What's next?
- Getting Started
- Withdrawal
- Staking API reference
Updated 8 days ago