HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
Guides

TRON ContractType

1. AccountCreateContract

Functionality Description

Creates a new basic TRON account, requiring a 0.1 TRX activation fee.

Field Description

Field NameData TypeDescription
owner_addressbytesAddress of the creator
account_addressbytesNewly generated address
typeenumAccount type (0=Normal, 1=Asset, 2=Contract)

Rules

  1. The creator account must satisfy the requirement: Balance ≥ 0.1 TRX
  2. When a new account is created via transfer:
    • The sending amount must include the 0.1 TRX activation fee.
    • The receiving address should not be used before.

2. TransferContract

Functionality Description

Executes basic TRX transfer operations.

Field Description

Field NameData TypeDescription
owner_addressbytesSender's address
to_addressbytesRecipient's address
amountint64Transfer amount (in SUN)

3. TransferAssetContract

Functionality Description

Executes TRC10 token transfers.

Field Description

Field NameData TypeDescription
asset_namebytesUnique identifier of a token
owner_addressbytesAddress of the token sender
to_addressbytesRecipient's address (must be activated)
amountint64Transfer quantity (needs to be multiplied by precision)

Rules

  1. Precision calculation formula: Actual quantity = Amount / 10^precision
    (Precision is defined during token issuance)

4. VoteWitnessContract

Functionality Description

Votes for Super Representatives (SRs).

Field Description

Field NameData TypeDescription
owner_addressbytesVoter's address
votesVote[]List of votes (maximum 30 items)

Voting Substructure

Field NameData TypeDescription
vote_addressbytesSR's address
vote_countint64Number of votes (1 vote = 1 staked TRX)

Rules

  1. Voting weight calculation:
    Effective votes = min (Staked TRX amount, Number of votes)
  2. Voting cycle: Statistics are collected every 6 hours.
  3. After unstaking TRX, the associated votes automatically become invalid.

5. WitnessCreateContract

Functionality Description

Registers to become an SR candidate.

Field Description

Field NameData TypeDescription
owner_addressbytesApplicant's address
urlbytesOfficial website URL (UTF-8 encoded)

Rules

  1. Application Requirements:
    • Requires staking 9,999 TRX (non-refundable).
    • The address must be running an SR node with an online rate ≥ 80%.
  2. Verification Requirements:
    • The same address cannot be registered repeatedly.

6. WitnessUpdateContract

Functionality Description

Updates the public information of an SR.

Field Description

Field NameData TypeDescription
owner_addressbytesSR's address
update_urlbytesNew official website URL (can be empty)

7. AssetIssueContract

Functionality Description

Creates and configures a TRC10-standard token.

Field Description

Field NameTypeDescription
idstringUnique identifier of the token
owner_addressbytesAddress of the token issuer
namebytesFull token name (UTF-8, maximum 32 bytes)
abbrbytesToken abbreviation (UTF-8, maximum 16 bytes)
total_supplyint64Total token supply (≥1)
frozen_supplyFrozenSupply[]List of token freeze plans
trx_numint32The amount of TRX required to exchange for 1 target token
precisionint32Decimal precision (0-8)
numint32Token issuance batch number
start_timeint64Crowdsale start time (UNIX milliseconds)
end_timeint64Crowdsale end time (UNIX milliseconds)
orderint64Reserved field (currently no practical use)
vote_scoreint32Voting weight coefficient
descriptionbytesToken description text (UTF-8)
urlbytesToken official website URL (UTF-8)

FrozenSupply Structure

Sub-fieldTypeDescription
frozen_amountint64Amount of frozen tokens
frozen_daysint64Number of frozen days (≥3 days)

Rules

  1. Issuance Requirements
    • The total supply must satisfy: total_supply ≥ 1
    • The token name must be unique across the entire network.

8. ParticipateAssetIssueContract

Functionality Description

Participates in TRC10 token crowdsales.

Field Description

Field NameData TypeDescription
owner_addressbytesParticipant's address
to_addressbytesSending address
asset_namebytesID of the target token
amountint64TRX amount (in SUN) used to purchase the issued token

Rules

  1. Exchange Logic:
    Token amount received = (Invested TRX amount × Token price denominator) / (Token price numerator × 10^Precision)
    
  2. Time Limit:
    • Must be operated within the token crowdsale period (start_time ≤ Current Time ≤ end_time).
  3. Failure Scenarios:
    • Crowdsale quota is full.
    • Participant's TRX balance is insufficient.

9. AccountUpdateContract

Functionality Description

Updates basic account information.

Field Description

Field NameData TypeDescription
owner_addressbytesOperator's address
account_namebytesNew account name (UTF-8)

10. FreezeBalanceContract

Functionality Description

Stakes TRX to obtain Bandwidth/Energy resources.

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the staking operator
frozen_balanceint64Amount of TRX to be staked (in SUN)
frozen_durationint64Number of staking days
resourceenumResource type:
0=Bandwidth (BANDWIDTH)
1=Energy (ENERGY)
receiver_addressbytesResource receiving address (can be delegated to another address)

Rules

  • The receiving address must be activated.
  • If no receiving address is specified, the resources will be sent to the owner_address by default.

11. UnfreezeBalanceContract

Functionality Description

Unfreezes staked TRX and returns Bandwidth/Energy resources.

Please note that this interface is no longer available after Stake 2.0 was enabled.

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the unstaking operator
resourceenumResource type:
0=Bandwidth (BANDWIDTH)
1=Energy (ENERGY)
receiver_addressbytesOriginal receiving address of those resources obtained by staking

Rules

  1. Unfreezing Conditions
    • Must satisfy the requirement of frozen_duration days set during staking.
    • Each unstaking request must correspond to a separate staking record.
  2. Permission Verification
    • Only the original staking operator (owner_address) is allowed to perform unstaking.
    • If a receiver_address exists, address signature verification is required.
  3. Resource Reclamation
    • Bandwidth/Energy resources become immediately invalid after unstaking.
    • TRX is returned to the original staking address after 3 solidified blocks.

12. WithdrawBalanceContract

Functionality Description

Allows SRs to claim block rewards or users to claim voting rewards.
Super Representatives can withdraw from their account balance; users can receive voting rewards from Super Representatives and deposit them into their account balance.

Field Description

Field NameData TypeDescription
owner_addressbytesSR or user address

Rules

  1. Reward Calculation:
    • Block reward = Number of blocks produced × Current block reward
    • Voting reward = Number of votes received × Voting reward coefficient
  2. Claiming Limits:
    • Minimum withdrawal amount: 1 TRX
    • Limit of 1 withdrawal per 24 hours

13. UnfreezeAssetContract

Functionality Description

Unfreezes frozen TRC10 token (requires issuer authorization).

Field Description

Field NameData TypeDescription
owner_addressbytesOperator's address

14. UpdateAssetContract

Functionality Description

Modifies basic parameters of an issued TRC10 token.

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the token issuer
descriptionbytesNew token description (UTF-8 encoded)
urlbytesNew token official website link (UTF-8 encoded)
new_limitint64New limit on the number of token holding addresses
new_public_limitint64New public offering limit

15. ProposalCreateContract

Functionality Description

Creates a new proposal to modify network parameters.

Field Description

Field NameData TypeDescription
owner_addressbytesAddress of the proposal creator
parametersmap<int64, int64>List of parameter modifications (key-value pairs)

Rules

  1. Proposal Content:
    • Modifiable parameters include: block reward, transaction fee rates, etc.
    • A single proposal can contain a maximum of 20 modifications.
  2. Effectiveness Conditions:
    • Requires approval from 2/3 + 1 SRs.
    • Takes effect in the next maintenance cycle after approval.

16. ProposalApproveContract

Functionality Description

SRs vote on proposals.

Field Description

Field NameData TypeDescription
owner_addressbytesAddress of the voting SR
proposal_idint64ID of the target proposal
is_add_approveboolAdd or remove approval (true=add)

Rules

  1. Voting Rights:
    • Only active SRs in the current cycle can vote.
    • Each SR can vote on each proposal only once.
  2. Voting Validity:
    • The lifespan of a proposal is 3 maintenance cycles.
    • Proposals that do not reach the required number of votes within the time limit are automatically rejected.

17. ProposalDeleteContract

Functionality Description

Deletes an existing network parameter modification proposal.

Field Description

Field NameData TypeDescription
owner_addressbytesAddress of the proposal deletion operator
proposal_idint64ID of the target proposal

Rules

  1. Deletion Rights:
    • Only the proposal creator or the SR committee can delete a proposal.
    • Proposals that have already taken effect cannot be deleted.
  2. Time Limit:
    • Proposals can only be deleted after 24 hours from creation.

18. SetAccountIdContract

Functionality Description

Sets a custom unique identifier (Account ID) for an account.

Field Description

Field NameData TypeDescription
owner_addressbytesAccount address
account_idbytesCustom ID (ASCII string)

19. CustomContract

Functionality Description

Executes legacy custom contract logic (deprecated).

Field Description

Field NameData TypeDescription
owner_addressbytesOperator's address (must be an SR node)
contract_databytesCustom data (maximum 256 KB)

Rules

  1. Compatibility Limits
    • Only supports versions ≤ v4.1.2
    • New contracts must use TriggerSmartContract.

20. CreateSmartContract

Functionality Description

Deploys a smart contract.

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the contract deployer
new_contractSmartContractSmart contract
call_token_valueint64Initial funding amount (TRC10)
token_idint64TRC10 token ID

SmartContract Structure

Field NameTypeRequiredDescription
origin_addressbytesYesAddress of the contract creator
contract_addressbytesYesOn-chain address of the contract
abiABIYesContract interface definition (including metadata like methods and events)
bytecodebytesYesEVM bytecode
call_valueint64NoAmount of TRX transferred during invocation (in SUN, 1 TRX = 1,000,000 SUN)
consume_user_resource_percentint64YesPercentage of user resource consumption (range 0-100, default 100)
namestringYesContract name
origin_energy_limitint64YesEnergy pre-allocated by the creator (minimum: 1_000_000)
code_hashbytesYesHash of the bytecode
trx_hashbytesYesDeployment transaction hash
versionint32YesProtocol version

ABI Nested Structure

Entry Structure Fields
Field NameTypeRequiredDescription
anonymousboolNoEvent anonymity identifier (only valid for Event type)
constantboolNo⚠️Deprecated (replaced by stateMutability)
namestringYesMethod/event name (empty for constructor)
inputsrepeated ParamYesList of input parameters (at least 1)
outputsrepeated ParamNoOutput parameters (only valid for Function)
typeEntryTypeYesEntry type (see enum tables enum table below)
payableboolNo⚠️Deprecated (replaced by stateMutability)
stateMutabilityStateMutabilityTypeYesState mutability (see enum tables table below)

Enumeration Type Tables

EntryType Enum
ValueEnum NameCorresponding ScenarioSolidity Example
0UnknownEntryTypeUnknown type (protocol reserved value)-
1ConstructorContract constructorconstructor() payable {}
2FunctionRegular functionfunction transfer() external {}
3EventOn-chain eventevent Transfer(address indexed)
4FallbackFallback functionfallback() external {}
5ReceiveFunction for receiving TRXreceive() external payable {}
6ErrorCustom errorerror InsufficientBalance();
StateMutabilityType Enum
ValueEnum NameState ImpactModifier Example
0UnknownMutabilityTypeUnknown state (protocol reserved value)-
1PureDoes not read or write statepure
2ViewRead-only stateview
3NonpayableModifiable state (cannot receive TRX)No modifier
4PayableModifies state (can receive TRX)payable

21. TriggerSmartContract

Functionality Description

Interacts with a smart contract.

Field Description

Field NameTypeDescription
owner_addressbytesBlockchain address of the caller
contract_addressbytesAddress of the contract being called
call_valueint64Amount of TRX transferred (in SUN, 1 TRX = 1,000,000 SUN)
databytesABI-encoded data (includes 4-byte function selector + 32-byte aligned parameter encoding)
call_token_valueint64Amount of TRC10 token transferred (needs to be multiplied by token precision, e.g., when the precision is 6, 1 token = 1,000,000)
token_idint64TRC10 token ID

22. GetContract

Functionality Description

Queries detailed information about a smart contract.

Parameter Parsing (BytesMessage)

Data Structure

message BytesMessage {
  bytes value = 1;
}

Input Requirements

FieldFormat
valueContract address

Return Value Parsing (SmartContract)

Key Field Description

FieldTypeDescription
origin_addressbytesAddress of the contract creator
contract_addressbytesOn-chain address of the contract
abi.entrysrepeated EntryList of contract interface definitions
bytecodebytesTVM bytecode

23. UpdateSettingContract

Functionality Description

Modifies the user resource consumption ratio of a smart contract (the resource allocation ratio between developers and users).

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the contract owner
contract_addressbytesTarget contract address
consume_user_resource_percentint64Percentage of resource consumption borne by the user (valid range: 0-100, default: 100)

24. ExchangeCreateContract

Functionality Description

Creates a TRC10/TRX token exchange pair.

Field Description

Field NameTypeDescription
owner_addressbytesCreator's address
first_token_idstringFirst token ID
first_token_balanceint64Initial token amount
second_token_idstringSecond token ID
second_token_balanceint64Initial token amount

Rules

  1. Token Pair Requirements
    • Must include at least one TRC10 token.
    • The two tokens cannot be the same.

25. ExchangeInjectContract

Functionality Description

Injects liquidity into an existing exchange pair.

Field Description

Field NameTypeDescription
owner_addressbytesLiquidity provider's address
exchange_idint64Exchange pair ID
token_idstringID of the injected token
quantint64Amount of the injected token

Rules

  1. Ratio Requirement
    • The injected token amount must match the current exchange pair ratio.
    • Transaction fails if the deviation exceeds 5%.

26. ExchangeWithdrawContract

Functionality Description

Withdraws liquidity from an exchange pair.

Field Description

Field NameTypeDescription
owner_addressbytesLiquidity withdrawer's address
exchange_idint64Exchange pair ID
token_idstringID of the withdrawn token
quantint64Amount of the withdrawn token

27. ExchangeTransactionContract

Functionality Description

Executes a token exchange operation within a pair.

Field Description

Field NameTypeDescription
owner_addressbytesTrader's address
exchange_idint64Exchange pair ID
token_idstringID of the token being sold
quantint64Amount of the token being sold
expectedint64Minimum expected receiving amount

28. UpdateEnergyLimitContract

Functionality Description

Modifies the Energy consumption limit of a smart contract.

Field Description

Field NameTypeDescription
owner_addressbytesContract owner's address
contract_addressbytesTarget contract address
origin_energt_limitint64Energy limit value

29. AccountPermissionUpdateContract

Functionality Description

Manages the multi-signature permission configuration of an account.

Field Description

Field NameTypeDescription
owner_addressbytesAccount address
ownerPermissionOwner permission configuration
witnessPermissionWitness permission configuration (can be empty)
activesPermission[]Active permission configuration

30. ClearABIContract

Functionality Description

Clears the ABI definition of a smart contract.

Field Description

Field NameTypeDescription
owner_addressbytesContract owner's address
contract_addressbytesTarget contract address

Rules

Impact of Clearing

  • External parties cannot parse contract methods via ABI.
  • Deployed contracts can still be executed.

31. UpdateBrokerageContract

Functionality Description

Adjusts the commission ratio for SRs.

Field Description

Field NameTypeDescription
owner_addressbytesSR's address
brokerageint32New commission ratio

Rules

  1. Ratio Range
    • Minimum: 0% (all distributed to voters)
    • Maximum: 100% (no reward distribution)

32. ShieldedTransferContract

Functionality Description

Implements private asset transfer functionality on the TRON network.

Field Description

Field NameTypeDescription
transparent_from_addressbytesTransparent sender's address
from_amountint64Amount of assets transferred from the transparent address (in SUN, 1 TRX = 1,000,000 SUN)
spend_descriptionSpendDescription[]Privacy transaction spending proof
receive_descriptionReceiveDescription[]Privacy transaction receiving proof (generates new private notes and zero-knowledge proofs)
binding_signaturebytesBinding signature (a cryptographic proof ensuring the total input and output amounts of the transaction are balanced)
transparent_to_addressbytesPublic recipient's address
to_amountint64Amount of assets transferred to the transparent address (in SUN)

Sub-structure SpendDescription & ReceiveDescription Parsing

Functionality Description

  • SpendDescription: Used to destroy private assets (destroys old notes and generates spending proofs).
  • ReceiveDescription: Used to generate new private assets (creates encrypted new notes).

SpendDescription Field Description

Field NameTypeKey Functionality
value_commitmentbytesValue commitment (based on Pedersen commitment, hides the actual amount but allows verification of correct calculation)
anchorbytesMerkle tree root (used to verify the existence of private notes in on-chain history)
nullifierbytesNote nullifier (uniquely identifies destroyed notes, preventing double-spending attacks)
rkbytesRe-randomization public key (a cryptographic parameter preventing transaction correlation)
zkproofbyteszk-SNARK proof (verifies the token amount validity, Merkle tree inclusion, and other logic)
spend_authority_signaturebytesSpend authority signature (a digital signature of key transaction parameters using the owner's private key)

ReceiveDescription Field Description

Field NameTypeKey Functionality
value_commitmentbytesValue commitment (corresponds to the same type of structure in SpendDescription)
note_commitmentbytesNote commitment (commitment of the recipient's private note encrypted and written to the blockchain)
epkbytesEphemeral public key (used to generate a symmetric encryption key to protect note data)
c_encbytesEncrypted note data (can be can be decrypted with the recipient's ivk to obtain note details)
c_outbytesAudit encrypted data (can be decrypted with the recipient's ovk to verify the transaction flow, visible only to the recipient and authorized parties)
zkproofbyteszk-SNARK proof (verifies the consistency of the new note's token amount with the commitment value)

33. DelegateResourceContract

Functionality Description

  • Implements resource delegation operations (such as Bandwidth and Energy).

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the resource owner
resourceResourceCodeResource type (0=Bandwidth, 1=Energy)
balanceint64Amount of the resources to be delegated (in SUN, 1 TRX = 1,000,000 SUN)
receiver_addressbytesAddress of the resource recipient
lockboolWhether to lock the delegation (true=locked, false=not locked)
lock_periodint64Lock period (in block numbers, 1 block ≈ 3 seconds, only valid when lock=true)

34. UnDelegateResourceContract

Functionality Description

Implements resource undelegation operations.

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the resource owner (same as the delegation operation address)
resourceResourceCodeResource type (must be consistent with the type at the time of delegation)
balanceint64Amount of resources to be undelegated (in SUN, the amount must be ≤ the delegated amount)
receiver_addressbytesAddress of the resource recipient (must be consistent with the address at the time of delegation)

35. MarketSellAssetContract

Functionality Description

Places an order to sell assets on the decentralized exchange.

Field Description

Field NameTypeDescription
owner_addressbytesSeller's address
sell_token_idstringID of the token to be sold
sell_token_quantityint64Selling quantity
buy_token_idstringID of the token to be bought
buy_token_quantityint64Expected receiving quantity

36. MarketCancelOrderContract

Functionality Description

Cancels a placed transaction order.

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the order creator
order_idbytesUnique hash of the order

37. FreezeBalanceV2Contract

Functionality Description

Used to stake TRX to obtain Bandwidth or Energy resources in Stake 2.0 of the TRON network (the original 1.0 staking method has been deprecated).

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the staking operation initiator
frozen_balanceint64Amount of TRX to be staked (in SUN, 1 TRX = 1,000,000 SUN)
resourceResourceCodeTarget resource type (0=Bandwidth, 1=Energy, 2=Vote Power)

Additional Notes

  1. Resource Acquisition Rules

    • The amount of resources obtainable per 1 TRX staked is dynamically calculated by the entire network.
    • Staking operations take effect immediately, and resources can be used instantly.
  2. Unstaking Mechanism

    • Unstaking needs to be done via UnfreezeBalanceV2Contract.
    • Staked funds need to wait at least 14 days (on-chain time) before they can be withdrawn.
  3. Resource Type Mapping

    ResourceCode ValueResource TypeUsage Scenario
    0BandwidthConsumption for all transactions
    1EnergyConsumption for smart contract execution

38. UnfreezeBalanceV2Contract

Functionality Description

Used to unfreeze staked TRX and return the Bandwidth/Energy resources (used in conjunction with FreezeBalanceV2Contract).

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the unstaking operation initiator
unfreeze_balanceint64Amount of TRX to be unstaked (in SUN, the amount must be ≤ the staked amount)
resourceResourceCodeTarget resource type (0=Bandwidth, 1=Energy, 2=Vote Power)

Core Rules

  1. Unstaking Delay Mechanism

    • After initiating unstaking, it takes 14 days (on-chain time) before TRX can be withdrawn.
    • During this period, the corresponding resource quota will gradually decrease.
  2. Resource Returning Calculation

    Resource TypeUnstaking Impact
    BandwidthImmediately reduces the available Bandwidth quota (calculated based on the proportion of unstaked TRX).
    EnergyUpdates the Energy quota in the next maintenance cycle.

39. WithdrawExpireUnfreezeContract

Functionality Description

Used to withdraw TRX funds that have passed the unstaking waiting period (must be executed after initiating UnfreezeBalanceV2Contract).

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the withdrawal operation initiator

40. CancelAllUnfreezeV2Contract

Functionality Description

Used to cancel all uncompleted unstaking operations (revokes initiated unstaking requests within the unstaking waiting period).

Field Description

Field NameTypeDescription
owner_addressbytesAddress of the operation initiator

Core Mechanism

  1. Operation Impact

    • Revokes all unstaking requests initiated via UnfreezeBalanceV2Contract that have not yet passed the 14-day waiting period (the unstaking waiting period for Stake 2.0 is 14 days, while it was 3 days for 1.0).
    • Restores the staking status of the corresponding TRX and maintains the original resource (Bandwidth/Energy) quota.
  2. Restrictions

    • Only effective for unexpired unstaking records (unstaking that has passed the 14-day waiting period cannot be cancelled).
    • The operation is irreversible; after cancellation, the unstaking process can only be initiated again.