Recipes
Copy-paste code examples for common TRON operations — sending transactions, querying state, deploying tokens, staking, governance, multi-sig, offline signing, and gRPC. Each recipe is self-contained and runnable.
Recipes cover common TRON development tasks. Each page focuses on one scenario, provides example code, and identifies any required tools, prerequisites, or security considerations.
Pair recipes with the conceptual chapters: the recipes show how; the How TRON Works chapter and the API reference explain why.
Send and query
The fundamentals — read state, send a transfer.
- 💸 Send your first transaction — send TRX between accounts with TronWeb; covers construction, signing, broadcast, fee calculation, and common errors
- 🔍 Query TRX balance and resources — read an account's TRX balance, Bandwidth, and Energy; covers sun-to-TRX conversion and the free-vs-staked distinction
Smart contracts and events
Explore contract examples, deploy contracts, and react to on-chain events.
- 🪙 Deploy a TRC-20 token — compile and deploy an ERC-20-compatible token on TRON; contract source, constructor arguments, deployment, and on-chain verification
- ⏱️ Timed-payment contract example — record a payer, recipient, and release time, then let the designated recipient claim test TRX when the payment is due
- 👂 Listen to contract events — subscribe to smart-contract events through TronGrid; polling, filtering by event name and block range, and payload decoding
Staking and governance
Stake 2.0, voting, and on-chain proposals.
- 🔒 Stake and delegate resources — stake TRX under Stake 2.0 to obtain Bandwidth or Energy; optionally delegate the resulting resources to another account
- 🗳️ Vote for Super Representatives — cast votes with your TRON Power and claim the voting rewards earned from it
- 📝 Create a governance proposal — submit a proposal to change a TRON network parameter; any SR, SR Partner, or SR Candidate can propose
Advanced
Multi-sig flows, offline signing, and lower-level transports.
- 🔐 Multi-sig transaction — sign and broadcast a transaction requiring multiple signatures via the account permission system
- ✍️ Offline sign a transaction — sign on an air-gapped machine, then broadcast from a separate online machine; the private key never touches the network
- 📡 API signature and broadcast flow — build, sign, and broadcast using only raw HTTP — no SDK required; useful for thin-client wallets, HSM integrations, and cross-language ports
- 📞 Call TRON via gRPC — call FullNode methods over gRPC using generated, strongly typed clients. With Protobuf encoding and HTTP/2 multiplexing, this approach is suitable for backend services that require high throughput and type safety.
End-to-end walkthrough
- Build a Web3 app — deploy a decentralized library and use TronLink and TronWeb to list, browse, and rent books with test TRX
Related resources
- Getting started — quick start and role-based reading tracks
- Send your first transaction — the conceptual walkthrough that accompanies the basic transfer recipe
- API reference overview — the underlying TRON APIs the recipes call
- Tools and SDKs — TronWeb, Trident, gotron-sdk, and other client libraries
Updated 9 days ago