Payments on the TON
Transacting with Toncoin: A Guide to Payments on the TON Network
On the TON blockchain, block generation occurs approximately every 5 seconds. This timing remains consistent even as network demand increases. Essentially, within those 5 seconds, the network can handle millions of transactions.
Additionally, TON’s blockchain features remarkably low transaction fees.
This setup is generally sufficient for most use cases.
In contrast, traditional banking apps may also process money transfers within seconds, but this is often masked by visual animations.
Reducing block times to, say, 500 milliseconds—like some other blockchains aim to—seems unnecessary for TON. Although technically feasible, such a reduction would require network nodes to handle and store a vast amount of data, which we believe is impractical. Prioritizing nominal performance metrics over practical efficiency is not ideal.
However, there are scenarios where extremely rapid transaction speeds and minimal fees are crucial.
For instance, paying for internet data through TON Proxy or TON Storage might involve fees as low as 0.000000001 TON per kilobyte (these figures are illustrative). Thus, downloading a 1GB file could involve millions of microtransactions, totaling approximately 0.01 TON.
To address this, Payment Channels have been introduced.
Payment Channels
Payment channel technology, also known as the Lightning Network, involves the following steps:
- Establishing the Channel: Two parties agree to conduct numerous transactions between themselves. They create a dedicated smart contract on the blockchain to which they send their initial deposits. For instance, Alice and Bob set up a payment channel, with Alice depositing 5 TON and Bob depositing 1 TON.
- Off-Chain Transactions: Alice and Bob can then carry out transactions between themselves off the blockchain. These transactions are signed with cryptographic algorithms to ensure security and validity.
- Closing the Channel: When Alice and Bob conclude their transactions, they finalize their balances and submit them to the smart contract. This contract then distributes the funds based on their final balances. For example, Alice might receive 4 TON and Bob 2 TON.
- Cost Efficiency: All transactions within the channel are processed off-chain, resulting in no transaction fees and immediate execution. Network fees are only incurred when opening and closing the payment channel.
- Contract Assurance: The smart contract ensures proper functioning of the channel. If one party attempts to act dishonestly or disappears, the other party can close the channel independently and claim the funds by providing mathematical proof.
This system allows for efficient and cost-effective transactions while maintaining security and trust.
Resources
A detailed technical overview of payment channels is available in Chapter 5 of the white paper:TON White Paper.
For pre-built smart contracts related to payment channels, visit:Payment Channels on GitHub.
Deep cryptographic knowledge is not required to work with payment channels. You can utilize existing SDKs:
- JavaScript SDK:TON Web SDK
- Example of implementing a payment channel:Payment Channels Example
Payment Channel Networks
As technology evolves, payment channels will be able to form networks off-chain, allowing multiple parties to participate in a single channel. Current smart contracts are already equipped to facilitate integration into such off-chain networks.
Summary
The TON blockchain offers fast transactions and low fees. For extremely rapid transaction speeds and numerous transactions with no fees, payment channels provide an effective solution.
The TON Payments technology has broad applications across various domains, including internet data payments, streaming services, gaming, and decentralized finance (DeFi).