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 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 — token amount 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.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
}'

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"
    }
  }
}

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:

curl --request POST \
     --url https://api.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"
}'

Example response:

{
  "error": null,
  "result": {
    "status": "success",
    "extraData": {
      "blockId": 5360497,
      "fee": 0.0065,
      "gas": {
        "used": 151375,
        "wanted": 260000
      },
      "transactionHash": "B5752ED7CA92428E85FAA496E024966F03CD6CEB6E32513BF7550F5C772A3A38"
    }
  }
}

Unstaking Flow

1. Create Unstaking Request

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

Example request:

curl --request POST \
     --url https://api.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
       }
}'

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"
    }
  }
}

2. Sign and Send Transaction

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

What's Next?