Sign and Broadcast Transaction

To complete any staking or withdrawal operation on Celestia, 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, staking/redelegate/from, staking/unstake.

2. Sign the transaction

Sign the transaction using your preferred Celestia signing method.

3. Send the transaction

Broadcast the signed transaction to the Celestia network by making a POST request to /api/v1/celestia/{network}/transaction/send.

Example request (for celestia-mainnet-beta network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/celestia/celestia-mainnet-beta/transaction/send \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <token>' \
     --header 'content-type: application/json' \
     --data '
     {
     "signedTransaction": "0aab010a9b010a232f636f736d6f732e7374616b696e672e763162657461312e4d736744656c656761746512740a2d636f736d6f733179397765666d6c706d30646a6b74387373656576656b653068747466756b67326136306730721234636f736d6f7376616c6f70657231376c676730337a65397836786b613032667330686877346164347777673035686571723279381a0d0a057561746f6d120434323030120b546865206d65737361676512670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103b0c7ac278e1941ac0b65d6bd45d541cae58aa584058fbbd822311b8718708c0e12040a020801181312130a0d0a057561746f6d12043539353210dfc30e1a4026d73408f2f516a2a26604cb5a63f3d57262a4462d10931c21d36c1ce9d73d8f7d051f1c4aabc2e3142c7f01a4935b85c5c7d3854e8a3c41f0c218daf2a7b5ef"
     }'
  • signedTransaction — signed transaction which needs to be broadcasted to the network.

Example response:

{
    "error": null,
    "result": {
        "status": "success",
        "blockId": 18575267,
        "fee": 0.005952,
        "gas": {
            "used": 202947,
            "wanted": 238047
        },
        "transactionHash": "ADD7B2791E1959075D1836D4BCC71ED256CCD724459F9BD8862D85E205075D47"
    }
}
  • status — transaction status: success, failed.
  • blockId — unique identifier of the block in which the transaction has been included.
  • fee — total fee in TIA charged for processing the transaction.
  • gas — computational effort required to execute the transaction, measured in gas units.
    • used — amount of gas spent for the transaction.
    • wanted — maximum gas limit that the transaction initiator was willing to consume for the transaction.
  • transactionHash — hash of the transaction.

What's next?