Build first tgBTC dApp
Last updated
Last updated
The TONX API enables seamless interaction with tgBTC, allowing developers to retrieve tgBTC-related data and execute transactions. Built with React and TypeScript, this project provides web3 developers with a practical implementation for integrating tgBTC into their applications. In this guide, we will explore how to leverage the TONX API for tgBTC integration.
Please note that tgBTC only supports testnet environments, and this API was built by independent community developers, so keep this in mind during development.
TON Teleport BTC allows seamless and secure BTC transfers between the Bitcoin and TON networks, without the need for centralized issuers. Its decentralized design and strong security features ensure trust and convenience. You can mint your first tgBTC using and .
connect your TON testnet wallet using TON Connect
check and manage your tgBTC balance with ease
send tgBTC to any account with just a few clicks
real-time transaction confirmation for full transparency and security using the TONX API
Before you start, ensure you have the following:
testnet wallet in TON (e.g., Tonkeeper, as shown in our )
TONX API key (testnet). Get access to the for free
basic knowledge of React and TypeScript to follow along with the code
pnpm package manager installed on your machine
Node.js (v16 or higher) for running the project
some tgBTC for testing transfers
Install dependencies
Install project dependencies
Create a .env file in the root directory
Great! At the end of the setup, replace your_api_key_here with your TONX API key.
Update the src/App.tsx file to include TonConnectButton, useTonWallet, and useTonConnectUI:
Configure the TONX API for testnet:
Use getJettonWallet to get the tgBTC balance:
Use getTgBTCTransferPayload API to generate a payload for the transaction message:
Use getJettonTransfers to check and confirm a tgBTC transaction after sending out an amount:
Start the development server:
After connecting the TON wallet:
Now you've created your first working tgBTC dApp using the third-party API by TONX.
With your environment set up and the TONX API integrated, you're ready to start using your application to manage tgBTC transactions. Test sending tgBTC, check balances in real time, and explore advanced features as your project grows.
For more methods, you can go to the next page!
In this project, we use the and to perform tgBTC transactions. For more details on the SDK, refer to the SDK guide. In particular, we use the following methods to execute tgBTC transactions:
Use your browser to try out the application (default: )
For the full implementation and source code, visit the project's .