Celestia

Unified API + Celestia Integration Workflow

In the following guide, the integration process for the celestia chain is covered. The Celestia integration aligns with the general Unified API process but with network-specific parameters.

Get an authentication token to start using the Unified API.

Request examples are provided using cURL.

To check the integration guides for other chains, refer to the Networks Supported section.

📘

Key Celestia-specific details

  • chain — always set to celestia for Celestia-related requests.
  • network — environment in which the transaction is processed: celestia-mainnet-beta or celestia-mocha-testnet.
  • stakerAddress — account address initiating staking, unstaking or withdrawal transactions.
  • amount — amount of tokens in TIA (in uTIA internally).

Staking Flow

1. Create Stake Request

Send a POST request to /api/v1/unified/staking/stake.

Example request (for celestia-mocha-testnet network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/stake \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
    "chain": "celestia",
    "network": "celestia-mocha-testnet",
    "stakerAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d",
    "amount": 1
}'
  • chain — blockchain network, always set to celestia for Celestia-related requests.
  • network — environment in which the transaction is processed: celestia-mainnet-beta or celestia-mocha-testnet.
  • stakerAddress — account address initiating the staking transaction.
  • amount — amount of tokens to stake in TIA.

Example response:

{
  "error": null,
  "result": {
    "amount": 1,
    "unsignedTransactionData": {
      "messages": [
        {
          "typeUrl": "/cosmos.staking.v1beta1.MsgDelegate",
          "value": {
            "delegatorAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d",
            "validatorAddress": "celestiavaloper1amm0umxqxxw8j2q60x78xs32s089606sdmvx92",
            "amount": {
              "denom": "utia",
              "amount": "1000000"
            }
          }
        }
      ],
      "fee": {
        "amount": [
          {
            "amount": "6500",
            "denom": "utia"
          }
        ],
        "gas": "260000"
      },
      "memo": "",
      "encodedBody": "0aa1010a232f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465127a0a2f63656c657374696131746d7070363333766633376436376c716e797578773561386c76766461716b737639686c3864123663656c657374696176616c6f70657231616d6d30756d7871787877386a32713630783738787333327330383936303673646d767839321a0f0a0475746961120731303030303030",
      "encodedAuthInfo": "12120a0c0a047574696112043635303010a0ef0f",
      "messageHash": "a6997d57f6e1b7dc63d6b0ff619195960fc0e9d44518932b5d5505a75715a3e5"
    },
    "createdAt": "2025-03-26T12:06:09.392Z",
    "extraData": {
      "currency": "tia",
      "validatorAddress": "celestiavaloper1amm0umxqxxw8j2q60x78xs32s089606sdmvx92",
      "stashAccountAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d",
      "rewardDestinationAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d"
    }
  }
}
  • amount — amount of tokens to stake in TIA.
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. The object contains the list of data fields to be used to construct the staking transaction.
    • messages — transaction messages for each staking operation.
      • typeUrl — Celestia network operation type.
      • value — message payload, encoded in the hexadecimal format.- delegatorAddress — account address initiating the delegation.
        • validatorAddress — validator address receiving the delegation.
        • amount.amount — amount of tokens to stake.
        • amount.denom — currency of tokens, always set to utia (1 TIA = 10⁻⁶ uTIA).
    • fee — fee charged for processing the transaction.
      • amount — amount of tokens.
        • denom — currency of tokens: tia, utia, or mtia.
        • gas — amount of gas spent for the transaction.
    • memo — arbitrary text data to add to the transactions.
    • encodedBody — processable transaction data encoded in the hexadecimal format.
    • encodedAuthInfo — authorization data, including fee, encoded in the hexadecimal format.
    • messageHash — hash of the transaction message.
  • createdAt — timestamp of the transaction in ISO 8601 format.
  • extraData — additional transaction details:
    • currency — TIA, Celestia native staking token.
    • validatorAddress — validator address to which tokens are delegated.
    • stashAccountAddress — account address initiating the staking transaction.
    • rewardDestinationAddress — account address receiving the staking rewards; stashAccountAddress by default.

2. Sign and Send Transaction

Use unsignedTransactionData to sign the transaction using the Celestia-specific signing logic.

To broadcast the signed transaction to the Celestia network, send a POST request to /api/v1/unified/transaction/broadcast.

Example request (for celestia-mocha-testnet network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/transaction/broadcast \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
     "chain": "celestia",
     "network": "celestia-mocha-testnet",
     "stakerAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d",
     "signedTransaction": "0aa4010aa1010a232f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465127a0a2f63656c657374696131746d7070363333766633376436376c716e797578773561386c76766461716b737639686c3864123663656c657374696176616c6f70657231616d6d30756d7871787877386a32713630783738787333327330383936303673646d767839321a0f0a047574696112073130303030303012640a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21030b155e1a5773bfae8759223f986febc4094328de05f79924363cc6887ffd9aed12040a02080112120a0c0a047574696112043635303010a0ef0f1a40ac6ddd90b1ceffcd099cd0dea54db06506b6c346b4e175ec68ae7d694fadd38123dce739dd047ca2dcac656534e2cde42a183412cb3431e89abf6be69de00d58"
}'
  • chain — blockchain network.
  • network — environment in which the transaction is processed.
  • stakerAddress — Celestia account address initiating the staking transaction.
  • signedTransaction — signed transaction in Base64 encrypted format, which contains all transaction details (e.g., accounts, instructions, and signatures) required to broadcast the transaction to the network.

Example response:

{
  "error": null,
  "result": {
    "status": "success",
    "extraData": {
      "blockId": 5360497,
      "fee": 0.0065,
      "gas": {
        "used": 151375,
        "wanted": 260000
      },
      "transactionHash": "B5752ED7CA92428E85FAA496E024966F03CD6CEB6E32513BF7550F5C772A3A38"
    }
  }
}
  • status — transaction status: pending, success, or failed.
  • extraData — additional transaction details:
    • 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 available to consume for the transaction.
    • transactionHash — hash of the transaction.

Unstaking Flow

1. Create Unstaking Request

Send a POST request to /api/v1/unified/staking/unstake.

Example request (for celestia-mocha-testnet network):

curl --request POST \
     --url https://api-test.p2p.org/api/v1/unified/staking/unstake \
     --header 'Content-Type: application/json' \
     --header 'Authorization: Bearer <token>' \
     --data '{
       "chain": "celestia",
       "network": "celestia-mocha-testnet",
       "stakerAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d",
       "extra": {
         "amount": 1
       }
       }'
  • chain — blockchain network.
  • network — environment in which the transaction is processed.
  • stakerAddress — account address initiated the staking transaction.
  • extra — additional request parameters:
    • amount — amount of tokens to unstake in TIA.

Example response:

{
  "error": null,
  "result": {
    "unsignedTransactionData": {
      "messages": [
        {
          "typeUrl": "/cosmos.staking.v1beta1.MsgUndelegate",
          "value": {
            "delegatorAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d",
            "validatorAddress": "celestiavaloper1amm0umxqxxw8j2q60x78xs32s089606sdmvx92",
            "amount": {
              "denom": "utia",
              "amount": "1000000"
            }
          }
        }
      ],
      "fee": {
        "amount": [
          {
            "amount": "4960",
            "denom": "utia"
          }
        ],
        "gas": "198384"
      },
      "memo": "",
      "encodedBody": "0aa3010a252f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c6567617465127a0a2f63656c657374696131746d7070363333766633376436376c716e797578773561386c76766461716b737639686c3864123663656c657374696176616c6f70657231616d6d30756d7871787877386a32713630783738787333327330383936303673646d767839321a0f0a0475746961120731303030303030",
      "encodedAuthInfo": "0a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21030b155e1a5773bfae8759223f986febc4094328de05f79924363cc6887ffd9aed12040a020801180112120a0c0a047574696112043439363010f08d0c",
      "messageHash": "3605ad63721f3759336806506ffb2e36c662dd63b699ad6c746d39e8dbeb98b6"
    },
    "createdAt": "2025-03-26T12:08:27.392Z",
    "extraData": {
      "amount": 1,
      "currency": "tia",
      "validatorAddress": "celestiavaloper1amm0umxqxxw8j2q60x78xs32s089606sdmvx92",
      "stashAccountAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d",
      "rewardDestinationAddress": "celestia1tmpp633vf37d67lqnyuxw5a8lvvdaqksv9hl8d"
    }
  }
}
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. The object contains the list of data fields to be used to construct the unstaking transaction.
    • messages — transaction messages for each staking operation.
      • typeUrl — network operation type.
      • delegatorAddress — delegator address.
      • validatorAddress — validator address.
      • amount — amount of tokens to unstake.
      • denom — currency of tokens, always set to utia (1 TIA = 10⁻⁶ uTIA).
    • fee — fee charged for processing the transaction.
      • amount — amount of tokens.
      • denom — currency of tokens: tia, utia, or mtia.
      • gas — amount of gas spent for the transaction.
    • memo — arbitrary text data to add to the transactions.
    • encodedBody — processable transaction data encoded in the hexadecimal format.
    • encodedAuthInfo — authorization data, including fee, encoded in the hexadecimal format.
    • messageHash — hash of the transaction.
  • createdAt — timestamp of the transaction in the ISO 8601 format.
  • extraData — additional transaction details:
    • amount — amount of tokens to unstake in TIA.
    • currency — currency of tokens: tia, utia, or mtia.
    • validatorAddress — validator address from which tokens are delegated.
    • stashAccountAddress — staking account address keeping the staked tokens.
    • rewardDestinationAddress — rewards destination account address.

2. Sign and Send Transaction

Use unsignedTransactionData to sign and send the transaction following the Celestia-specific signing logic.

What's Next?