Getting Started

There are two ways to start staking on the TON network using the Staking API:

  • Stake individually with a validator via a single nominator pool.
  • Stake along with multiple nominators via Ton Whales pools.

🚧

About single nominator pools

This is an alternative type of the TON smart contract designed for validators that have enough self stake to validate by themselves without relying on third-party nominators stakes.

Staking via this flow is possible only through the specific nominator address. Since the P2P team has to prepare a separate pool for your address, contact us and provide your address before you start working with the API.

For both flows, to start using the Staking API:

  1. Create a stake transaction.
  2. Sign and broadcast it to the network.

Get an authentication token to start using Staking API.

Request examples are provided using cURL.

1. Create Stake Transaction

Depending on the type of your staking pool, send a POST request either to /api/v1/ton/{network}/staking/single-nominator/stake or to /api​/v1​/ton​/{network}​/staking​/ton-whales​/stake.

Example request (in the testnet network for a single nominator pool):

curl --request POST \
     --url https://api.p2p.org/api/v1/ton/testnet/staking/single-nominator/stake \
     --header 'accept: application/json' \\
 		 --header 'authorization: Bearer <token>' \\
 		 --header 'content-type: application/json' \\
 		 --data '
{
  "publicKey": "7031f1dcbe0f670daf4094d04ff9a7947bc4ac9174a7d470255d1a664e20b7c6",
  "amount": 20000000000,
  "walletVersion": "V4"

}'
  • publicKey — public key of the nominator for the TON network.

  • amount — amount of tokens to stake in nanoTONs (1 TON = 10⁹ nanoTONs). Note that the minimum staking amount is not limited, but there is a maximum cap of 2 000 000 TON for each pool.

  • walletVersionversion of the smart contract used by the wallet in the TON blockchain:

    • V3R1 and V3R2 — wallet V3.
    • V4 — wallet V4; used by default.
    • V5R1 — wallet V5.

Example response:

{
  "error": null,
  "result": {
    "unsignedTransaction": "b5ee9c7241010101003800006b000010000000000000000001000000039fedeab7a2b56b38f19f60b5b9f70b2f1ba2d89b9c5a756036c7cfad73571fb281887735940193456f7e",
    "walletVersion": "V4",
    "stakerAddress": "0QDZncytCDTPJylG1POFhqzeCLDFZNKhJ2v73lcsBNjQHMZx",
    "publicKey": "7031f1dcbe0f670daf4094d04ff9a7947bc4ac9174a7d470255d1a664e20b7c6",
    "amount": 2
  }
}
  • unsignedTransactionunsigned transaction in the hexadecimal format. Sign the transaction and submit it to the blockchain to create a staking request.

  • poolAddress — nominator pool address (for Ton Whales pools).

  • walletVersionversion of the smart contract used by the wallet in the TON blockchain.

  • stakerAddress — main account address of the bounceable type which keeps tokens.

  • publicKey — public key of the nominator for the TON network.

  • amount — amount of tokens to stake in TON.

2. Sign and Broadcast Transaction

Sign and broadcast the unsignedTransaction to the TON network.

To check the transaction status, send a GET request to /api/v1/ton/{network}/transactions/status/{address}/{transactionHash}.

Example request (in the testnet network for a single nominator pool):

curl --request GET \
     --url https://api.p2p.org/api/v1/ton/testnet/transactions/status/0QDZncytCDTPJylG1POFhqzeCLDFZNKhJ2v73lcsBNjQHMZx/2829e4bb8a7b8084040c731a07523d680ce30fecef12f8eec1e409f3c6077a5e \
     --header 'accept: application/json'
  • address — staker account address.
  • transactionHash — hash of the transaction.

Example response:

{
    "error": null,
    "result": {
      "address": "0QC1f6DghlW6w31D7GWiYt0dZvX1SR3sGAsto_AhdQRFBobh",
      "lt": "27726830000001",
      "prevTransactionHash": "6210303f3cfb630c349b3859d9e367a65a6772938c681774e2a315aa95c80224",
      "prevTransactionLt": "1234567890abcdef",
      "now": 1730905768,
      "outMessagesCount": 1,
      "oldStatus": "active",
      "endStatus": "active",
      "transactionHash": "2829e4bb8a7b8084040c731a07523d680ce30fecef12f8eec1e409f3c6077a5e"
  },
}
  • address — staker account address.
  • lt — logical time of the last transaction created by this staker account.
  • prevTransactionHash — hash of the previous transaction.
  • prevTransactionLt — logical time of the previous transaction.
  • now — current time on the TON blockchain node.
  • outMessagesCount — count of output messages sent by the smart contract in the result of this transaction.
  • oldStatus — staker account status before transaction execution.
  • endStatus — staker account status after transaction execution.
  • transactionHash — hash of the transaction.

What's Next?