Get Started
Install and create your first gas-free Tron wallet.
This guide explains how to install the package, create a gas-free wallet, and get your first account.
1. Install the Package
Prerequisites
npm install @tetherto/wdk-wallet-tron-gasfree2. Create a Gas-Free Wallet
You can create a new gas-free wallet instance using the WalletManagerTronGasfree constructor with a BIP-39 seed phrase, Tron RPC provider, and gas-free service configuration:
import WalletManagerTronGasfree, {
WalletAccountTronGasfree,
WalletAccountReadOnlyTronGasfree
} from '@tetherto/wdk-wallet-tron-gasfree'
const seedPhrase = 'your twelve word seed phrase here'
const wallet = new WalletManagerTronGasfree(seedPhrase, {
chainId: 728126428,
provider: 'https://api.trongrid.io',
gasFreeProvider: 'https://gasfree.provider.url',
gasFreeApiKey: 'your-gasfree-api-key',
gasFreeApiSecret: 'your-gasfree-api-secret',
serviceProvider: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
verifyingContract: 'TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH',
transferMaxFee: 10000000 // Optional: maximum fee in token base units
})Secure the Seed Phrase: You must securely store this seed phrase immediately. If it is lost, the user will permanently lose access to their funds.
3. Get Your First Account
You can retrieve an account at a given index using wallet.getAccount():
const account = await wallet.getAccount(0)
const address = await account.getAddress()
console.log('Gas-free account address:', address)4. (optional) Convert to Read-Only
You can convert an owned account to a read-only account using account.toReadOnlyAccount():
const readOnlyAccount = await account.toReadOnlyAccount()All Tron addresses start with T and are 34 characters long.
Next Steps
With your wallet ready, learn how to manage multiple accounts.