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 are self-contained, copy-paste code examples for the operations TRON developers reach for most often. Each recipe is runnable as-is — install the SDK, swap in your address and key, and execute.
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
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
- 👂 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 — invoke fullnode methods directly over gRPC for lower latency, native streaming, and strong typing
Longer walkthroughs
For end-to-end project tutorials that span multiple steps:
- Build a Web3 app — a complete walkthrough from contract deployment to a working frontend; longer read than the snippets above
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 7 days ago