TRON dApp integration
EXZIX Wallet exposes TRON through a TronLink-compatible provider. Use window.tronLink for connection and signing, and use an independent TronWeb/full-node client to build canonical contract transactions. The injected provider does not expose private keys or arbitrary transaction builders.
What is supported
EXZIX supports TRON account connection, account/network reads, TRX and TRC-20 transaction review, contract-call decoding and local signing. Contract transactions open in the user-selected Popup or Side Panel. The website never receives a private key.
- Connection: tron_requestAccounts or tron_connect
- Reads: tron_accounts, tron_chainId and supported TRON RPC reads
- Signing: tron_signMessage, tron_signTransaction and tron_sendTransaction
- Broadcast: tron_sendRawTransaction only for a transaction already approved by EXZIX
Connect EXZIX Wallet
Call the provider from a visible user action. The returned address is the wallet account selected by the user.
const wallet = window.tronLink;
if (!wallet?.request) throw new Error('EXZIX TRON Wallet is not installed or enabled');
const accounts = await wallet.request({ method: 'tron_requestAccounts' });
const address = Array.isArray(accounts) ? accounts[0] : accounts;
console.log({ address, network: window.tronWeb?.defaultAddress?.base58 });Network handling
TRON networks use a chain/network key rather than an EVM hexadecimal chain ID. Keep the selected network explicit, for example tron-mainnet or tron-nile. The owner address, transaction ref block and full-node endpoint must belong to the same network. The wallet cannot silently switch a site to another network during signing.
Build and review a contract transaction
Build the unsigned transaction with TronWeb configured for the target full node. Pass the unsigned canonical transaction to EXZIX for review and signing. The approval screen shows the contract, function, TRX value, fee limit and network. Do not ask the wallet to build a transaction from untrusted calldata, and do not show a generic “confirm” button without displaying the target and value.
// Build with a separate TronWeb instance configured for the required full node.
// Do not use the injected EXZIX window.tronWeb as a transaction builder.
const { transaction } = await builder.transactionBuilder.triggerSmartContract(
contractAddress,
'transfer(address,uint256)',
{ feeLimit: 100_000_000 },
parameters,
ownerAddress,
);
const signed = await window.tronLink.request({
method: 'tron_signTransaction',
params: [transaction],
});
const broadcast = await window.tronLink.request({
method: 'tron_sendTransaction',
params: [signed],
});
console.log(broadcast.txid || broadcast.txID);TRC-20 and native TRX
For TRC-20 transfers, encode the contract call with the token ABI and verify the token contract address and decimals on your server. For native TRX transfers, create a normal transfer transaction with the canonical owner and recipient. In both cases, wait for the broadcast response and then confirm the transaction through the authoritative TRON node or EXZIX server observer.
Sign in with a TRON wallet
A wallet signature is not an EXZIX account password. Issue a one-time server nonce, include domain, address and expiry in the exact message, request a TRON message signature and verify it server-side. Consume the nonce after one successful verification and bind the session to the normalized base58 address. Never trust a client-provided address without checking the recovered signer.
const challenge = await fetch('/auth/wallet/nonce', { credentials: 'include' }).then((r) => r.json());
const accounts = await window.tronLink.request({ method: 'tron_requestAccounts' });
const address = Array.isArray(accounts) ? accounts[0] : accounts;
const message = `${challenge.domain} wants you to sign in.\nAddress: ${address}\nNonce: ${challenge.nonce}\nIssued At: ${challenge.issuedAt}\nExpiration Time: ${challenge.expiresAt}`;
const signed = await window.tronLink.request({
method: 'tron_signMessage',
params: [message],
});
// Send address, exact message and signature to your server.
// Verify the recovered base58 address and consume the nonce exactly once.Errors and approval surfaces
4001 means user rejection; 4100 means the website is not connected or the signed transaction is stale; 4200 means the requested method is unsupported; -32602 means the unsigned transaction is malformed. EXZIX controls Popup versus Side Panel using the user setting. Do not try to open an extension page yourself or retry a rejected contract call automatically.
TRON checklist
Use a network-specific full node; connect from a user action; validate owner, contract, selector, parameters and fee limit; simulate or estimate energy/bandwidth; request signing; broadcast; confirm; handle expired ref blocks, insufficient energy, fee-limit exhaustion, wrong network, rejection and pending receipts.
Skip to content
