Create TON Wallet
Learn how to create, access, and transact with your first TON Wallet using an app and through code.
Basics
Mainnet or Testnet?
TON Blockchain operates on two variations - mainnet and testnet. The mainnet allows real transactions with real TON coins, while testnet is used for testing and development purposes.
Mainnet transactions involve real TON coins whilst testnet is a sandbox for testing and development. Be cautious when working with mainnet, as any mistakes can lead to the loss of real funds.
Creating a Wallet using an App
Setting up a TON Wallet can be accomplished with the following steps:
- Visit https://ton.org/wallets.
- Choose a wallet app from the list, such as Tonkeeper or TON Wallet.
- Follow the instructions provided by the chosen wallet app to create a new wallet.
- Securely store your recovery phrase and private keys, as they are essential for accessing your wallet and funds.
Backing Up the Recovery Phrase
A 24-word recovery phrase is key to accessing your wallet. Losing this phrase will result in loss of access to your wallet and funds. Make sure to store it securely, such as by writing it down on paper and keeping it in a safe place.
Viewing the Wallet in an Explorer
Your wallet address can be retrieved by tapping on the top-left of the Tonkeeper app or the “Receive” button. Once you have your address, you can view your wallet’s details and transactions using a TON blockchain explorer, such as TON.sh or TONScan.
Funding and Activating the Wallet Contract
Funding the wallet can be achieved by transferring TON coins to your address. After the wallet is funded, the wallet contract can be deployed. This process is usually automated by the wallet app, but it’s essential to understand that the wallet contract needs to be deployed before you can start using it.
Wallet Contracts and Their Versions
The version of your smart contract code can be seen in the “Contract Type” field in the explorer. It’s important to know which version of the wallet contract you are using, as different versions may have different features and compatibility.
Setting up Local Machine for Programmatic Access
Before writing code to interact with your wallet, certain developer tools need to be installed on your local machine, such as:
- TON SDK: A set of libraries and tools for developing TON applications.
- Node.js: A JavaScript runtime environment.
- A code editor, such as Visual Studio Code or WebStorm.
Fetching the Wallet Address Programmatically
After setting up your local machine, you can retrieve your wallet’s address in the code and match it with the explorer’s address. This can be done using the TON SDK, which provides functions for interacting with the TON blockchain.
Here’s an example of how to fetch your wallet address using the TON SDK in JavaScript:
Reading Wallet State from the Chain
You can read live state data from your wallet contract by directly connecting to the live blockchain network. This allows you to retrieve information such as your wallet’s balance, transaction history, and other relevant data.
Here’s an example of how to read your wallet’s balance using the TON SDK in JavaScript:
Sending a Transfer Transaction to the Chain
You can also send TON from your wallet to another wallet on the chain. However, this action will require your wallet’s private key.
Be extremely cautious when handling private keys, as they grant full access to your wallet and funds. Never share your private keys with anyone, and make sure to store them securely.
Here’s an example of how to send a transfer transaction using the TON SDK in JavaScript:
By leveraging the TON blockchain, you can perform efficient and low-cost token transactions on the ONTON Finance platform. Enjoy tight spreads and a smooth trading experience, while getting ONTON tokens as a discount on transaction fees.