Sei

Unified API + Sei Integration Workflow

In the following guide, the integration process for the sei chain is covered. The Sei 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 Sei-specific details

  • chain — always set to sei for Sei-related requests.
  • network — environment in which the transaction is processed (pacific-1 or atlantic-2).
  • stakerAddress — account address initiating staking, unstaking or withdrawal transactions.
  • amount — amount of tokens in SEI.

Staking Flow

1. Create Staking Request

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

Example request (for pacific-1 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": "sei",
    "network": "pacific-1",
    "stakerAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp",
    "amount": 0.1
}'
  • chain — blockchain network, always set to sei for Sei-related requests.
  • network — environment in which the transaction is processed (pacific-1 or atlantic-2).
  • stakerAddress — account address initiating the staking transaction.
  • amount — amount of tokens to stake in SEI, minimum amount is 0.1.

Example response:

{
    "error": null,
    "result": {
        "amount": 0.1,
        "stakerAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp",
        "unsignedTransactionData": {
            "messages": [
                {
                    "typeUrl": "/cosmos.staking.v1beta1.MsgDelegate",
                    "value": {
                        "delegatorAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp",
                        "validatorAddress": "seivaloper1qmpxlswwk42wya67t7zsaawf3vur03cuevss0h",
                        "amount": {
                            "denom": "usei",
                            "amount": "100000"
                        }
                    }
                }
            ],
            "fee": {
                "amount": [
                    {
                        "amount": "4851",
                        "denom": "usei"
                    }
                ],
                "gas": "194020"
            },
            "memo": "abc",
            "encodedBody": "0a96010a232f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465126f0a2a7365693138667a67767a79336830713634367771326e777a34327a72743578737279757366386a6d6d70123173656976616c6f70657231716d70786c7377776b3432777961363774377a736161776633767572303363756576737330681a0e0a047573656912063130303030301203616263",
            "encodedAuthInfo": "0a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103c0caf89df9997994f61207d69c755060aeadf9cbf1ba3ea3fa9117bdb304414e12040a020801180612120a0c0a047573656912043438353110e4eb0b",
            "messageHash": "ef6f9484c2aaf4d27b9b1354e2a52491869f5250746976fcaba3c30f8437ac03"
        },
        "createdAt": "2025-03-06T12:53:02.657Z",
        "extraData": {
            "currency": "sei",
            "validatorAddress": "seivaloper1qmpxlswwk42wya67t7zsaawf3vur03cuevss0h",
            "rewardDestinationAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp"
        }
    }
}
  • amount — amount of tokens to stake in SEI.
  • stakerAddress — staking account address receiving the staked tokens.
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. It contains the list of data fields to be used to construct the staking transactions:
    • messages:
      • typeUrl — Sei network operation type.
      • delegatorAddress — delegator address.
      • validatorAddress — validator address.
      • amount — amount of tokens to stake.
      • denom — currency of tokens:
        • sei — SEI native staking token.
        • usei — 1 SEI = 10⁻⁶ uSEI.
        • msei — 1 SEI = 10⁻³ mSEI.
    • fee — fee charged for processing the transaction.
      • amount — amount of tokens.
      • denom — currency of tokens: sei, usei, or msei.
      • 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:
    • currency — currency of tokens: sei, usei, or msei.
    • validatorAddress — validator address to which tokens are delegated.
    • rewardDestinationAddress — reward destination account address.

2. Sign and Send Transaction

Use unsignedTransactionData to sign the transaction.

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

Example request:

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": "sei",
    "network": "pacific-1",
    "stakerAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp",
    "amount": 0.1,
    "signedTransaction":    "0a9e010a96010a232f636f736d6f732e7374616b696e672e763162657461312e4d736744656c6567617465126f0a2a7365693138667a67767a79336830713634367771326e777a34327a72743578737279757366386a6d6d70123173656976616c6f70657231716d70786c7377776b3432777961363774377a736161776633767572303363756576737330681a0e0a04757365691206313030303030120361626312660a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103c0caf89df9997994f61207d69c755060aeadf9cbf1ba3ea3fa9117bdb304414e12040a020801180612120a0c0a047573656912043438353110e4eb0b1a4012ce8717390c205ea7fc800c1d0aeacc260d558906f2825756cdef24a13daaae57256b6a8b1085ae8af77f8c9a59a83933b9f5a456e5d563f9048ab1bb691036"
}'
  • chain — blockchain network.
  • network — environment in which the transaction is processed.
  • stakerAddress — staking account address receiving the staked tokens.
  • amount — amount of tokens to stake in SEI.
  • 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": 135190135,
            "fee": 0.004850999999999999,
            "gas": {
                "used": 160707,
                "wanted": 194020
            },
            "transactionHash": "76EDCE98041DFA42615DEA1BF483AD4752D2C389B8B312DFEB4F5171F7F57BBD"
        }
    }
}
  • status — transaction status: success, failed.
  • extraData — additional transaction details:
    • blockId — unique identifier of the block in which the transaction has been included.
    • fee — total fee in SEI 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 pacific-1 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": "sei",
    "network": "pacific-1",
    "stakerAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp"
    "extra": {
      "amount": 0.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 SEI, minimum amount is 0.1.

Example response:

{
    "error": null,
    "result": {
        "unsignedTransactionData": {
            "messages": [
                {
                    "typeUrl": "/cosmos.staking.v1beta1.MsgUndelegate",
                    "value": {
                        "delegatorAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp",
                        "validatorAddress": "seivaloper1qmpxlswwk42wya67t7zsaawf3vur03cuevss0h",
                        "amount": {
                            "denom": "usei",
                            "amount": "100000"
                        }
                    }
                }
            ],
            "fee": {
                "amount": [
                    {
                        "amount": "5222",
                        "denom": "usei"
                    }
                ],
                "gas": "208859"
            },
            "memo": "",
            "encodedBody": "0a98010a252f636f736d6f732e7374616b696e672e763162657461312e4d7367556e64656c6567617465126f0a2a7365693138667a67767a79336830713634367771326e777a34327a72743578737279757366386a6d6d70123173656976616c6f70657231716d70786c7377776b3432777961363774377a736161776633767572303363756576737330681a0e0a04757365691206313030303030",
            "encodedAuthInfo": "0a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a2103c0caf89df9997994f61207d69c755060aeadf9cbf1ba3ea3fa9117bdb304414e12040a020801180712120a0c0a047573656912043532323210dbdf0c",
            "messageHash": "eb685b1e4f0c8fe5fb9c44ec83bc58ca5351756b28a78ec32efa8df7c736f77b"
        },
        "createdAt": "2025-03-06T12:55:03.838Z",
        "extraData": {
            "amount": 0.1,
            "currency": "sei",
            "validatorAddress": "seivaloper1qmpxlswwk42wya67t7zsaawf3vur03cuevss0h",
            "stashAccountAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp",
            "rewardDestinationAddress": "sei18fzgvzy3h0q646wq2nwz42zrt5xsryusf8jmmp"
        }
    }
}
  • unsignedTransactionData — unsigned transaction in Base64 encrypted format. It is the list of data fields to be used to construct the staking transactions.
    • messages:
      • typeUrl — Sei network operation type.
      • delegatorAddress — delegator address.
      • validatorAddress — validator address.
      • amount — amount of tokens to unstake.
      • denom — currency of tokens:
        • sei — SEI native staking token.
        • usei — 1 SEI = 10⁻⁶ uSEI.
        • msei — 1 SEI = 10⁻³ mSEI.
    • fee — fee charged for processing the transaction.
      • amount — amount of tokens.
      • denom — currency of tokens: sei, usei, or msei.
      • 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 SEI.
    • currency — currency of tokens: sei, usei, or msei.
    • 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 Sei-specific signing logic.

What's Next?