> ## Documentation Index
> Fetch the complete documentation index at: https://docs.p2p.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Tezos

> Unified API + Tezos Integration Workflow

In the following guide, the integration process for the `xtz` chain is covered. The Tezos integration aligns with the general [Unified API process](/docs/unified-api-getting-started) but with network-specific parameters.

[Get an authentication token](/docs/authentication) to start using the Unified API.

Request examples are provided using [cURL](https://curl.se/).

> To check the integration guides for other chains, refer to the [Networks Supported](/docs/unified-api-networks) section.

<Note>
  **Key Tezos-specific details**

  * `chain` — always set to `xtz` for Tezos-related requests.
  * `network` — environment in which the transaction is processed: `mainnet` only.
  * `stakerAddress` — Tezos account address initiating staking, unstaking or withdrawal transactions.
  * `amount` — amount of tokens in XTZ.
</Note>

## Staking flow

### 1. Create reveal request

If you have not performed any operations on this account before, create a reveal request by sending a POST request to [/api/v1/unified/staking/stake](/reference/unified-create-stake-transaction).

Example request (for `mainnet` network):

<CodeGroup>
  ```bash bash theme={null}
  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": "xtz",
    "network": "mainnet",
    "stakerAddress": "tz1Nfu7TmHj7GWARYHrxdVZ75BgcHwUnr3PM",
    "amount": "5",
    "extra": {
      "operationType": "reveal",
      "additionalAddresses": {
        "tezosPubKey": "edpkvUh57bdTwgaHBE9bYVPLRv3myqzoD8RLsiRNnQs5TxvhdLswQ9"
      }
    }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network, always set to `xtz` for Tezos-related requests.

* `network` — environment in which the transaction is processed: `mainnet` only.

* `stakerAddress` — Tezos account address initiating the reveal transaction.

* `amount` — amount of tokens to reveal in XTZ.

* `extra` — additional parameters.

  * `operationType` — type of operation; set to `reveal` for new accounts.
  * `additionalAddresses`— additional network addresses:
    * `tezosPubKey` — staker public key.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "amount": 5,
          "stakerAddress": "tz1Nfu7TmHj7GWARYHrxdVZ75BgcHwUnr3PM",
          "unsignedTransactionData": "5d601c0133d2cba0c9345fb5...",
          "createdAt": "2025-06-03T23:36:22.450Z",
          "extraData": {
              "transactionId": "c23982ec-07aa-426b-a867-013cdacbd281",
              "stakeId": "7ba5b6c6-e0e3-481c-8388-57ea3d15cacc",
              "gasEstimate": {
                  "amount": "0.000279000000000000",
                  "gasLimit": ""
              }
          }
      }
  }
  ```
</CodeGroup>

* `amount` — amount of tokens to reveal in XTZ.

* `stakerAddress` — Tezos account address initiating the transaction.

* `unsignedTransactionData` — unsigned transaction in Base64 encrypted format. The object contains the list of data fields to be used to construct the reveal transaction.

* `createdAt` — timestamp of the transaction in the ISO 8601 format.

* `extraData` — additional transaction details:

  * `transactionId` — unique identifier of the reveal transaction.

  * `stakeId` — unique identifier of the staking request.

  * `gasEstimate` — estimated gas usage details:

    * `amount` — estimated fee in XTZ for processing the transaction.
    * `gasLimit` — maximum gas limit for the transaction; option can be left empty or ignored, since it is not used in Tezos and reserved for compatibility only.

### 2. Sign and send transaction

Use `unsignedTransactionData` to [sign](/docs/unified-api-signing-transaction) the transaction.

To broadcast the signed transaction to the Tezos network, send a POST request to [/api/v1/unified/transaction/broadcast](/reference/unified-transaction-send).

Example request:

<CodeGroup>
  ```bash bash theme={null}
  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": "xtz",
      "network": "mainnet",
      "signedTransaction": "{\"bytes\":\"024c70799bc16c1c95db0091ef51441bd6b8d2bf105a4a17793c776d530f82a16e002142e1ae4c4456b6f3742dd6510ea6dc7d2c11f48c029bf5ad4fa8010000\",\"sig\":\"sigWhmkraxYHSmd1SQS156Y1MvuBBzZ9sK9qFjiGoRDufGpEL6kXRyjmDx4rbGcUzzNatCUWipLvs7cQATocmqDFdVxjJ4n8\",\"prefixSig\":\"edsigtgXEsuorpDdogCRha2vHVJeSg1GvXnjuXX1UScoQEFgE84GhFRM4ppTs7TD4hxBLp8MpQ2WBBYptMCCfTm7oQJhbqPj5AJ\",\"sbytes\":\"024c70799bc16c1c95db0091ef51441bd6b8d2bf105a4a17793c776d530f82a16e002142e1ae4c4456b6f3742dd6510ea6dc7d2c11f48c029bf5ad4fa8010000429d6cadd75dcbc026097e94d90e6145bf477e9bd8a1ffa2948b81509f522ff1f30148bf227c6d83b1c3d98e9cd8f8e71177152b6dca938fe82da73bfaac8603\"}",
      "stakerAddress": "tz1Nfu7TmHj7GWARYHrxdVZ75BgcHwUnr3PM",
      "extra": {
          "transactionId": "7977e904-e9bb-43d8-9c09-83812a15e8a8"
      }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network.
* `network` — environment in which the transaction is processed.
* `signedTransaction` — signed transaction as a JSON string, including `bytes`, `sig`, `prefixSig`, and `sbytes` fields, which contains all transaction details (e.g., accounts, instructions, and signatures) required to broadcast the transaction to the network.
* `stakerAddress` — Tezos account address initiating the transaction.
* `extra` — additional request parameters:
  * `transactionId` — unique identifier of the reveal transaction.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "extraData": {
              "transactionHash": "oo3mw16oJqrBair2s31dvDhKjTXjKNcRPjJthKKN1qMnvjE7eCz"
          }
      }
  }
  ```
</CodeGroup>

* `extraData` — additional transaction details:
  * `transactionHash` — transaction hash on the Tezos network, which can be tracked in [tzkt.io](tzkt.io) explorer.

### 3. Create staking request

> Note that Tezos accounts can have only 1 delegation at a time.

Send a POST request to [/api/v1/unified/staking/stake](/reference/unified-create-stake-transaction).

Example request:

<CodeGroup>
  ```bash bash theme={null}
  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": "xtz",
    "network": "mainnet",
    "stakerAddress": "tz1Nfu7TmHj7GWARYHrxdVZ75BgcHwUnr3PM",
    "amount": "5",
    "extra": {
      "additionalAddresses": {
        "tezosPubKey": "edpkvUh57bdTwgaHBE9bYVPLRv3myqzoD8RLsiRNnQs5TxvhdLswQ9"
      }
    }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network.
* `network` — environment in which the transaction is processed.
* `stakerAddress` — Tezos account address initiating the transaction.
* `amount` — amount of tokens to delegate in XTZ. Minimum amount is 5 XTZ.
* `extra` — additional parameters.
  * `additionalAddresses`— additional network addresses:
    * `tezosPubKey` — staker public key; required for non-revealed accounts.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "amount": 5,
          "stakerAddress": "tz1Nfu7TmHj7GWARYHrxdVZ75BgcHwUnr3PM",
          "unsignedTransactionData": "74aec234a40c4adfe6d68c5dbd104d04f0804e0e...",
          "createdAt": "2025-06-03T23:36:36.439Z",
          "extraData": {
              "transactionId": "0a471c05-0714-4249-a4a0-e83d4a648fc0",
              "stakeId": "d7ac3d47-d2ee-4704-8c5c-ea174ef7bc0b",
              "gasEstimate": {
                  "amount": "0.000279000000000000",
                  "gasLimit": ""
              }
          }
      }
  }
  ```
</CodeGroup>

* `amount` — amount of tokens to stake in XTZ.

* `stakerAddress` — Tezos account address initiating the staking transaction.

* `unsignedTransactionData` — unsigned transaction in Base64 encrypted format. Sign the transaction and submit it to the blockchain to perform the called action.

* `createdAt` — timestamp of the transaction in the ISO 8601 format.

* `extraData` — additional transaction details:

  * `transactionId` — unique identifier of the transaction within this staking session.

  * `stakeId` — unique identifier of the staking request.

  * `gasEstimate` — estimated gas usage details:

    * `amount` — estimated fee in XTZ for processing the transaction.
    * `gasLimit` — maximum gas limit for the transaction; can be left empty or ignored, since it is not used in Tezos and reserved for compatibility only.

### 4. Sign and send transaction

Use `unsignedTransactionData` to [sign and send](/docs/unified-api-signing-transaction) the transaction following the Tezos-specific signing logic.

## Unstaking flow

### 1. Create unstaking request

Send a POST request to [/api/v1/unified/staking/unstake](/reference/unified-create-unstake-transaction).

Example request:

<CodeGroup>
  ```bash bash theme={null}
  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": "xtz",
    "network": "mainnet",
    "stakerAddress": "tz1Nfu7TmHj7GWARYHrxdVZ75BgcHwUnr3PM",
    "extra": {
      "amount": 5
    }
  }'
  ```
</CodeGroup>

* `chain` — blockchain network.
* `network` — environment in which the transaction is processed.
* `stakerAddress` — Tezos account address initiating the transaction.
* `extra`— additional parameters:
  * `amount` — amount of tokens to unstake in XTZ.

Example response:

<CodeGroup>
  ```json JSON theme={null}
  {
      "error": null,
      "result": {
          "amount": 5,
          "stakerAddress": "tz1Nfu7TmHj7GWARYHrxdVZ75BgcHwUnr3PM",
          "unsignedTransactionData": "024c70799bc16c1c95db0091ef51441bd6b8d2bf105a4a17793c776d530f82a1...",
          "createdAt": "2025-06-05T12:09:40.751Z",
          "extraData": {
              "transactionId": "b2757302-8e89-4227-a841-461936ccd971",
              "stakeId": "a78b76b6-e866-4dd3-9a7d-3a89f5937ec7",
              "gasEstimate": {
                  "amount": "0.000248000000000000",
                  "gasLimit": ""
              }
          }
      }
  }
  ```
</CodeGroup>

* `amount` — amount of XTZ to be unstaked.

* `stakerAddress` — Tezos account address initiating the transaction.

* `unsignedTransactionData` — unsigned transaction in Base64 encrypted format. Sign the transaction and submit it to the blockchain to perform the called action.

* `createdAt` — timestamp of the transaction in the ISO 8601 format.

* `extraData` — additional transaction details:

  * `transactionId` — unique identifier of the transaction within this unstaking session.

  * `stakeId` — unique identifier of the unstaking request.

  * `gasEstimate` — estimated gas usage details:

    * `amount` — estimated fee in XTZ for processing the transaction.
    * `gasLimit` — maximum gas limit for the transaction; can be left empty or ignored, since it is not used in Tezos and reserved for compatibility only.

### 2. Sign and send transaction

> Note that the withdrawal is available only after the unstaking period of 4 days ends.

Use `unsignedTransactionData` to [sign and send](/docs/unified-api-signing-transaction) the transaction following the Tezos-specific signing logic.


## Related topics

- [Unified API Reference](/reference/unified-create-stake-transaction.md)
- [Integration Workflow Example](/docs/unified-api-getting-started.md)
- [Networks Supported](/docs/unified-api-networks.md)
