Smart contracts on TRON

TRON smart contracts run on the TRON Virtual Machine (TVM), which is EVM-compatible at the bytecode level. This chapter covers the concepts, development lifecycle, advanced topics, and security guidance for building on TRON.

TRON smart contracts run on the TRON Virtual Machine (TVM) — a deterministic, sandboxed runtime that is EVM-compatible at the bytecode level. Most Solidity contracts written for Ethereum compile and run on TRON with minimal changes. The differences are largely TRON-specific extensions for Bandwidth, Energy, staking, and TRC-10 tokens.

This chapter is organized into four subsections, plus a quickstart for new readers and a chapter root index (this page).

Quickstart

New to TRON contracts?

Jump to Quickstart — deploy your first contract in 10 minutes using TronBox CLI on the Shasta testnet.

Chapter map

Concepts

The foundational concepts you need before writing TRON contracts: what the TVM is, how it differs from the EVM, the Solidity language extensions specific to TRON, and the full opcode reference.

Concepts

Development lifecycle

The end-to-end build workflow: prepare resources, write and compile, deploy, interact, and verify on TRONSCAN.

Development lifecycle

Advanced topics

Patterns and TRON-specific contract features: parameter encoding, contract-to-contract calls, upgradeable contracts, errors and exception handling, the Stake 2.0 Solidity SDK, event logs, and feeLimit cost management.

Advanced Topic

Security and migration

Security best practices and walkthroughs for porting Ethereum (Truffle / Hardhat) projects to TRON. (Runtime-error diagnostic flows have moved to the Troubleshooting chapter.)

Security and migration

Choosing your path

If you want to...Start here
Deploy your first contract right awayQuickstart
Understand how the TVM worksTVM
Port an Ethereum contract to TRONMigrating from Ethereum
Estimate deployment costObtaining Energy + FeeLimit & Energy cost
Audit an existing contractSecurity + Best practices + Smart contract errors
Look up a specific opcodeOpcodes
Stake, vote, or delegate from a contractStake 2.0 Solidity SDK reference

Related resources

  • Token standards — the standards built on top of TRON smart contracts (TRC-20, TRC-721, TRC-1155)
  • Resource model — Bandwidth, Energy, and how staking works
  • Oracles on TRON — price feeds and off-chain data sources that contracts commonly compose with
  • TronBox documentation — community CLI for compiling and deploying TRON contracts
  • TronWeb SDK — JavaScript SDK for interacting with TRON contracts