Gasless
Gasless transactions on the TON platform enable users to send transactions without paying gas fees directly from their wallets. This is achieved using Signed Internal Messages sent through a gas proxy contract, which covers the transaction fees on behalf of the user. This approach simplifies blockchain interactions, making it easier for users who may not have TON tokens in their wallets.
This service only works with W5 wallets
Architecture
Gasless transactions leverage Signed Internal Messages. These messages are signed by the user but routed through a smart contract that pays the fees using a gas proxy. This eliminates the need for users to hold TON tokens for transaction fees.
TONAPI plays a critical role by simulating transaction execution to accurately estimate fees and sending the transaction to multiple validators to increase the chances of successful processing. Additionally, TONAPI ensures that the user’s wallet and gas proxy contract are in the same shard, minimizing latency and ensuring fast transaction processing.
Process for Executing
- Fetch Configuration: Request the gasless transaction parameters using
/v2/gasless/config
. - Estimate Transaction: Send a POST request to
/v2/gasless/estimate/{master_id}
to receive a payload for signing. - Sign Payload: Sign the received payload with your private key.
- Send Transaction: Submit the signed message via POST to
/v2/gasless/send
.
Implementation Examples
- TypeScript: See an implementation example for gasless transactions in TypeScript here.
- Go: Find the Go implementation example here.
Operations
gaslessConfig
- Returns configuration of gasless transfersgaslessEstimate
- Estimates the cost of the given messages and returns a payload to signgaslessSend
- Submits the signed gasless transaction message to the network