Sign and Broadcast Transaction

To sign and broadcast a transaction to the TON network for a single nominator pool:

  1. Initialize the service by installing dependencies from this repository.

  2. In the ton-sign.ts file, specify the staker account's seed phrase and prepare unsigned transactions in Base64 encrypted format.

  3. Sign the transaction using the code.

  4. Finally, send the signed transaction to the TON network by making a POST request to /api/v1/ton/{network}/transaction/send.

Example request (for testnet network):

curl --request POST \
     --url https://api.p2p.org/api/v1/ton/testnet/transaction/send \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <token>' \
     --header 'content-type: application/json' \
     --data '
   {
     "signedTransaction": "te6ccgEBAQEABgAACCiAmCM=",
     "signature": "te6ccgEBAQEABgAACCiAmCM=",
     "publicKey": "7031f1dcbe0f670daf4094d04ff9a7947bc4ac9174a7d470255d1a664e20b7c6",
     "walletVersion": "V4"
   }'
  • signedTransactionsigned transactionin the hexadecimal format which needs to be broadcasted to the network.
  • signature — external message signature, which has to be signed with the private key.
  • publicKey — public key of the nominator for the TON network.
  • walletVersionversion of the smart contract used by the wallet in the TON blockchain.

Example response:

{
  "error": null,
  "result": {
    "transactionHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
  }
}
  • transactionHash — hash of the transaction.

What's Next?