Types of Wallet Contracts
You may have heard about different versions of wallets on the TON Blockchain. But what do these versions actually mean, and how do they differ?
In this article, we’ll explore the various versions and modifications of TON wallets.
How can wallets be different?
Before diving in, let’s understand how wallets on TON can differ.
In blockchains like Ethereum, Solana, and others, there are no distinct types or versions of wallets. So why are there different wallet versions in TON? It’s because, in TON, wallets are implemented as smart contracts.
These smart contracts can be set up in different ways and can have different features. That's why there are several versions of wallets in TON.
Basic wallets
Wallet V1
This is the simplest one. It only allows you to send one transaction at the time and it doesn't check anything besides your signature and seqno.
This version isn't even used in regular apps because it has some major issues:
- No easy way to retrieve the seqno and public key from the contract
- No
valid_until
check, so you can't be sure that the transaction won't be confirmed too late.
The first issue is fixed in V1R2
and V1R3
. That R
stands for revision
. Usually revisions are just small updates which only add get-methods which allows you to retrieve seqno and public key from the contract.
However, the second issue is fixed in the next version.
Wallet source code:
Wallet V2
This version introduces the valid_until
parameter which is used to set a time limit for a transaction in case you don't want it to be confirmed too late. This version also doesn't have the get-method for public key, which is added in V2R2
.
It can be used in most cases, but it misses one cool feature, which was added in V3
.
Wallet source code:
Wallet V3
This version introduces the subwallet_id
parameter, which allows you to create multiple wallets using the same public key (so you can have only one seed phrase and lots of wallets). And, as before, V3R2
only adds the get-method for public key.
Basically, subwallet_id
is just a number added to the contract state when it is deployed. And since the contract address in TON is a hash of its state and code, the wallet address will change with a different subwallet_id
.
This version is the most used right now. It covers most use-cases and remains clean and simple.
Wallet source code:
Wallet V4
It is the most modern wallet version at the moment. It still has all the functionality of the previous versions, but also introduces something very powerful — plugins
.
This feature allows developers to implement complex logic that will work in tandem with a user's wallet. For example, some DApp may require a user to pay a small amount of coins every day to use some features, so the user would need to install the plugin on their wallet by signing a transaction. This plugin would send coins to the destination address daily when requested by an external message.
This is a very customizable feature which is unique to TON Blockchain.
Wallet source code:
Wallet V5
This is an extensible wallet specification developed by the Tonkeeper team, aimed at replacing V4 and allowing arbitrary extensions.
The W5 wallet standard offers many benefits that improve the experience for both users and merchants. W5 supports gas-free transactions, account delegation and recovery, subscription payments using tokens and Toncoin, and low-cost multi-transfers.
Users will have access to a 25% reduction in blockchain fees, a new flexible plugin interface for developers, and an internal message signature that enables delegation of gas payments.
In addition to retaining the previous functionality (v4), the new contract allows you to send up to 255 messages at a time, as well as to make full-fledged gasless transactions (e.g., payment of network fees when transferring USDt in USDt itself) and other features. We believe it will enhance the usability and capabilities for TON users.
Wallet V5 wallets allow transactions to be initiated by the user but paid for by another contract. Consequently, there will be services (such as Tonkeeper's Battery) that provide this functionality: they pay the transaction fees in TONs on behalf of the user, but charge a fee in tokens.
UI Preparation and Beta Testing
- UI: Already now, wallet teams can start UI preparations. You can use the v5-beta smart contract as a test smart contract, but keep in mind that it will can change. UI suggestion: wallets that have multi-accounts could support the new v5 smart contract as a separate account in the UI. Provide a “Transfer funds between your accounts” functionality.
- Beta: If you build v5 functionality into public versions of your products, please mark it as “beta” and do not use the v5 contract by default, but only when explicitly enabled in the settings. Please observe this rule to prevent too wide distribution of the non-final beta version of the v5 smart contract.
- Release: The final smart contract will be ready around June 20, after which wallets can enable v5 by default using the final smart contract. It will be updated here.