TRON ContractType
1. AccountCreateContract
Functionality Description
Creates a new basic TRON account, requiring a 0.1 TRX activation fee.
Field Description
Field Name | Data Type | Description |
---|---|---|
owner_address | bytes | Address of the creator |
account_address | bytes | Newly generated address |
type | enum | Account type (0=Normal, 1=Asset, 2=Contract) |
Rules
- The creator account must satisfy the requirement:
Balance ≥ 0.1 TRX
- 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 Name | Data Type | Description |
---|---|---|
owner_address | bytes | Sender's address |
to_address | bytes | Recipient's address |
amount | int64 | Transfer amount (in SUN) |
3. TransferAssetContract
Functionality Description
Executes TRC10 token transfers.
Field Description
Field Name | Data Type | Description |
---|---|---|
asset_name | bytes | Unique identifier of a token |
owner_address | bytes | Address of the token sender |
to_address | bytes | Recipient's address (must be activated) |
amount | int64 | Transfer quantity (needs to be multiplied by precision) |
Rules
- 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 Name | Data Type | Description |
---|---|---|
owner_address | bytes | Voter's address |
votes | Vote[] | List of votes (maximum 30 items) |
Voting Substructure
Field Name | Data Type | Description |
---|---|---|
vote_address | bytes | SR's address |
vote_count | int64 | Number of votes (1 vote = 1 staked TRX) |
Rules
- Voting weight calculation:
Effective votes = min (Staked TRX amount, Number of votes)
- Voting cycle: Statistics are collected every 6 hours.
- After unstaking TRX, the associated votes automatically become invalid.
5. WitnessCreateContract
Functionality Description
Registers to become an SR candidate.
Field Description
Field Name | Data Type | Description |
---|---|---|
owner_address | bytes | Applicant's address |
url | bytes | Official website URL (UTF-8 encoded) |
Rules
- Application Requirements:
- Requires staking 9,999 TRX (non-refundable).
- The address must be running an SR node with an online rate ≥ 80%.
- Verification Requirements:
- The same address cannot be registered repeatedly.
6. WitnessUpdateContract
Functionality Description
Updates the public information of an SR.
Field Description
Field Name | Data Type | Description |
---|---|---|
owner_address | bytes | SR's address |
update_url | bytes | New official website URL (can be empty) |
7. AssetIssueContract
Functionality Description
Creates and configures a TRC10-standard token.
Field Description
Field Name | Type | Description |
---|---|---|
id | string | Unique identifier of the token |
owner_address | bytes | Address of the token issuer |
name | bytes | Full token name (UTF-8, maximum 32 bytes) |
abbr | bytes | Token abbreviation (UTF-8, maximum 16 bytes) |
total_supply | int64 | Total token supply (≥1) |
frozen_supply | FrozenSupply[] | List of token freeze plans |
trx_num | int32 | The amount of TRX required to exchange for 1 target token |
precision | int32 | Decimal precision (0-8) |
num | int32 | Token issuance batch number |
start_time | int64 | Crowdsale start time (UNIX milliseconds) |
end_time | int64 | Crowdsale end time (UNIX milliseconds) |
order | int64 | Reserved field (currently no practical use) |
vote_score | int32 | Voting weight coefficient |
description | bytes | Token description text (UTF-8) |
url | bytes | Token official website URL (UTF-8) |
FrozenSupply Structure
Sub-field | Type | Description |
---|---|---|
frozen_amount | int64 | Amount of frozen tokens |
frozen_days | int64 | Number of frozen days (≥3 days) |
Rules
- Issuance Requirements
- The total supply must satisfy:
total_supply ≥ 1
- The token name must be unique across the entire network.
- The total supply must satisfy:
8. ParticipateAssetIssueContract
Functionality Description
Participates in TRC10 token crowdsales.
Field Description
Field Name | Data Type | Description |
---|---|---|
owner_address | bytes | Participant's address |
to_address | bytes | Sending address |
asset_name | bytes | ID of the target token |
amount | int64 | TRX amount (in SUN) used to purchase the issued token |
Rules
- Exchange Logic:
Token amount received = (Invested TRX amount × Token price denominator) / (Token price numerator × 10^Precision)
- Time Limit:
- Must be operated within the token crowdsale period
(start_time ≤ Current Time ≤ end_time)
.
- Must be operated within the token crowdsale period
- Failure Scenarios:
- Crowdsale quota is full.
- Participant's TRX balance is insufficient.
9. AccountUpdateContract
Functionality Description
Updates basic account information.
Field Description
Field Name | Data Type | Description |
---|---|---|
owner_address | bytes | Operator's address |
account_name | bytes | New account name (UTF-8) |
10. FreezeBalanceContract
Functionality Description
Stakes TRX to obtain Bandwidth/Energy resources.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the staking operator |
frozen_balance | int64 | Amount of TRX to be staked (in SUN) |
frozen_duration | int64 | Number of staking days |
resource | enum | Resource type: 0=Bandwidth (BANDWIDTH) 1=Energy (ENERGY) |
receiver_address | bytes | Resource 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the unstaking operator |
resource | enum | Resource type: 0=Bandwidth (BANDWIDTH) 1=Energy (ENERGY) |
receiver_address | bytes | Original receiving address of those resources obtained by staking |
Rules
- Unfreezing Conditions
- Must satisfy the requirement of
frozen_duration
days set during staking. - Each unstaking request must correspond to a separate staking record.
- Must satisfy the requirement of
- Permission Verification
- Only the original staking operator (
owner_address
) is allowed to perform unstaking. - If a
receiver_address
exists, address signature verification is required.
- Only the original staking operator (
- 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 Name | Data Type | Description |
---|---|---|
owner_address | bytes | SR or user address |
Rules
- Reward Calculation:
- Block reward = Number of blocks produced × Current block reward
- Voting reward = Number of votes received × Voting reward coefficient
- 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 Name | Data Type | Description |
---|---|---|
owner_address | bytes | Operator's address |
14. UpdateAssetContract
Functionality Description
Modifies basic parameters of an issued TRC10 token.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the token issuer |
description | bytes | New token description (UTF-8 encoded) |
url | bytes | New token official website link (UTF-8 encoded) |
new_limit | int64 | New limit on the number of token holding addresses |
new_public_limit | int64 | New public offering limit |
15. ProposalCreateContract
Functionality Description
Creates a new proposal to modify network parameters.
Field Description
Field Name | Data Type | Description |
---|---|---|
owner_address | bytes | Address of the proposal creator |
parameters | map<int64, int64> | List of parameter modifications (key-value pairs) |
Rules
- Proposal Content:
- Modifiable parameters include: block reward, transaction fee rates, etc.
- A single proposal can contain a maximum of 20 modifications.
- 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 Name | Data Type | Description |
---|---|---|
owner_address | bytes | Address of the voting SR |
proposal_id | int64 | ID of the target proposal |
is_add_approve | bool | Add or remove approval (true=add) |
Rules
- Voting Rights:
- Only active SRs in the current cycle can vote.
- Each SR can vote on each proposal only once.
- 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 Name | Data Type | Description |
---|---|---|
owner_address | bytes | Address of the proposal deletion operator |
proposal_id | int64 | ID of the target proposal |
Rules
- Deletion Rights:
- Only the proposal creator or the SR committee can delete a proposal.
- Proposals that have already taken effect cannot be deleted.
- 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 Name | Data Type | Description |
---|---|---|
owner_address | bytes | Account address |
account_id | bytes | Custom ID (ASCII string) |
19. CustomContract
Functionality Description
Executes legacy custom contract logic (deprecated).
Field Description
Field Name | Data Type | Description |
---|---|---|
owner_address | bytes | Operator's address (must be an SR node) |
contract_data | bytes | Custom data (maximum 256 KB) |
Rules
- Compatibility Limits
- Only supports versions ≤ v4.1.2
- New contracts must use
TriggerSmartContract
.
20. CreateSmartContract
Functionality Description
Deploys a smart contract.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the contract deployer |
new_contract | SmartContract | Smart contract |
call_token_value | int64 | Initial funding amount (TRC10) |
token_id | int64 | TRC10 token ID |
SmartContract Structure
Field Name | Type | Required | Description |
---|---|---|---|
origin_address | bytes | Yes | Address of the contract creator |
contract_address | bytes | Yes | On-chain address of the contract |
abi | ABI | Yes | Contract interface definition (including metadata like methods and events) |
bytecode | bytes | Yes | EVM bytecode |
call_value | int64 | No | Amount of TRX transferred during invocation (in SUN, 1 TRX = 1,000,000 SUN) |
consume_user_resource_percent | int64 | Yes | Percentage of user resource consumption (range 0-100, default 100) |
name | string | Yes | Contract name |
origin_energy_limit | int64 | Yes | Energy pre-allocated by the creator (minimum: 1_000_000 ) |
code_hash | bytes | Yes | Hash of the bytecode |
trx_hash | bytes | Yes | Deployment transaction hash |
version | int32 | Yes | Protocol version |
ABI Nested Structure
Entry Structure Fields
Field Name | Type | Required | Description |
---|---|---|---|
anonymous | bool | No | Event anonymity identifier (only valid for Event type) |
constant | bool | No | ⚠️Deprecated (replaced by stateMutability ) |
name | string | Yes | Method/event name (empty for constructor) |
inputs | repeated Param | Yes | List of input parameters (at least 1) |
outputs | repeated Param | No | Output parameters (only valid for Function ) |
type | EntryType | Yes | Entry type (see enum tables enum table below) |
payable | bool | No | ⚠️Deprecated (replaced by stateMutability ) |
stateMutability | StateMutabilityType | Yes | State mutability (see enum tables table below) |
Enumeration Type Tables
EntryType Enum
Value | Enum Name | Corresponding Scenario | Solidity Example |
---|---|---|---|
0 | UnknownEntryType | Unknown type (protocol reserved value) | - |
1 | Constructor | Contract constructor | constructor() payable {} |
2 | Function | Regular function | function transfer() external {} |
3 | Event | On-chain event | event Transfer(address indexed) |
4 | Fallback | Fallback function | fallback() external {} |
5 | Receive | Function for receiving TRX | receive() external payable {} |
6 | Error | Custom error | error InsufficientBalance(); |
StateMutabilityType Enum
Value | Enum Name | State Impact | Modifier Example |
---|---|---|---|
0 | UnknownMutabilityType | Unknown state (protocol reserved value) | - |
1 | Pure | Does not read or write state | pure |
2 | View | Read-only state | view |
3 | Nonpayable | Modifiable state (cannot receive TRX) | No modifier |
4 | Payable | Modifies state (can receive TRX) | payable |
21. TriggerSmartContract
Functionality Description
Interacts with a smart contract.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Blockchain address of the caller |
contract_address | bytes | Address of the contract being called |
call_value | int64 | Amount of TRX transferred (in SUN, 1 TRX = 1,000,000 SUN) |
data | bytes | ABI-encoded data (includes 4-byte function selector + 32-byte aligned parameter encoding) |
call_token_value | int64 | Amount of TRC10 token transferred (needs to be multiplied by token precision, e.g., when the precision is 6, 1 token = 1,000,000) |
token_id | int64 | TRC10 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
Field | Format |
---|---|
value | Contract address |
Return Value Parsing (SmartContract)
Key Field Description
Field | Type | Description |
---|---|---|
origin_address | bytes | Address of the contract creator |
contract_address | bytes | On-chain address of the contract |
abi.entrys | repeated Entry | List of contract interface definitions |
bytecode | bytes | TVM 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the contract owner |
contract_address | bytes | Target contract address |
consume_user_resource_percent | int64 | Percentage 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Creator's address |
first_token_id | string | First token ID |
first_token_balance | int64 | Initial token amount |
second_token_id | string | Second token ID |
second_token_balance | int64 | Initial token amount |
Rules
- 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Liquidity provider's address |
exchange_id | int64 | Exchange pair ID |
token_id | string | ID of the injected token |
quant | int64 | Amount of the injected token |
Rules
- 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Liquidity withdrawer's address |
exchange_id | int64 | Exchange pair ID |
token_id | string | ID of the withdrawn token |
quant | int64 | Amount of the withdrawn token |
27. ExchangeTransactionContract
Functionality Description
Executes a token exchange operation within a pair.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Trader's address |
exchange_id | int64 | Exchange pair ID |
token_id | string | ID of the token being sold |
quant | int64 | Amount of the token being sold |
expected | int64 | Minimum expected receiving amount |
28. UpdateEnergyLimitContract
Functionality Description
Modifies the Energy consumption limit of a smart contract.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Contract owner's address |
contract_address | bytes | Target contract address |
origin_energt_limit | int64 | Energy limit value |
29. AccountPermissionUpdateContract
Functionality Description
Manages the multi-signature permission configuration of an account.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Account address |
owner | Permission | Owner permission configuration |
witness | Permission | Witness permission configuration (can be empty) |
actives | Permission[] | Active permission configuration |
30. ClearABIContract
Functionality Description
Clears the ABI definition of a smart contract.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Contract owner's address |
contract_address | bytes | Target 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 Name | Type | Description |
---|---|---|
owner_address | bytes | SR's address |
brokerage | int32 | New commission ratio |
Rules
- 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 Name | Type | Description |
---|---|---|
transparent_from_address | bytes | Transparent sender's address |
from_amount | int64 | Amount of assets transferred from the transparent address (in SUN, 1 TRX = 1,000,000 SUN) |
spend_description | SpendDescription[] | Privacy transaction spending proof |
receive_description | ReceiveDescription[] | Privacy transaction receiving proof (generates new private notes and zero-knowledge proofs) |
binding_signature | bytes | Binding signature (a cryptographic proof ensuring the total input and output amounts of the transaction are balanced) |
transparent_to_address | bytes | Public recipient's address |
to_amount | int64 | Amount 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 Name | Type | Key Functionality |
---|---|---|
value_commitment | bytes | Value commitment (based on Pedersen commitment, hides the actual amount but allows verification of correct calculation) |
anchor | bytes | Merkle tree root (used to verify the existence of private notes in on-chain history) |
nullifier | bytes | Note nullifier (uniquely identifies destroyed notes, preventing double-spending attacks) |
rk | bytes | Re-randomization public key (a cryptographic parameter preventing transaction correlation) |
zkproof | bytes | zk-SNARK proof (verifies the token amount validity, Merkle tree inclusion, and other logic) |
spend_authority_signature | bytes | Spend authority signature (a digital signature of key transaction parameters using the owner's private key) |
ReceiveDescription Field Description
Field Name | Type | Key Functionality |
---|---|---|
value_commitment | bytes | Value commitment (corresponds to the same type of structure in SpendDescription) |
note_commitment | bytes | Note commitment (commitment of the recipient's private note encrypted and written to the blockchain) |
epk | bytes | Ephemeral public key (used to generate a symmetric encryption key to protect note data) |
c_enc | bytes | Encrypted note data (can be can be decrypted with the recipient's ivk to obtain note details) |
c_out | bytes | Audit encrypted data (can be decrypted with the recipient's ovk to verify the transaction flow, visible only to the recipient and authorized parties) |
zkproof | bytes | zk-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 Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the resource owner |
resource | ResourceCode | Resource type (0=Bandwidth, 1=Energy) |
balance | int64 | Amount of the resources to be delegated (in SUN, 1 TRX = 1,000,000 SUN) |
receiver_address | bytes | Address of the resource recipient |
lock | bool | Whether to lock the delegation (true=locked, false=not locked) |
lock_period | int64 | Lock period (in block numbers, 1 block ≈ 3 seconds, only valid when lock=true) |
34. UnDelegateResourceContract
Functionality Description
Implements resource undelegation operations.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the resource owner (same as the delegation operation address) |
resource | ResourceCode | Resource type (must be consistent with the type at the time of delegation) |
balance | int64 | Amount of resources to be undelegated (in SUN, the amount must be ≤ the delegated amount) |
receiver_address | bytes | Address 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Seller's address |
sell_token_id | string | ID of the token to be sold |
sell_token_quantity | int64 | Selling quantity |
buy_token_id | string | ID of the token to be bought |
buy_token_quantity | int64 | Expected receiving quantity |
36. MarketCancelOrderContract
Functionality Description
Cancels a placed transaction order.
Field Description
Field Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the order creator |
order_id | bytes | Unique 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the staking operation initiator |
frozen_balance | int64 | Amount of TRX to be staked (in SUN, 1 TRX = 1,000,000 SUN) |
resource | ResourceCode | Target resource type (0=Bandwidth, 1=Energy, 2=Vote Power) |
Additional Notes
-
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.
-
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.
- Unstaking needs to be done via
-
Resource Type Mapping
ResourceCode Value Resource Type Usage Scenario 0 Bandwidth Consumption for all transactions 1 Energy Consumption 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the unstaking operation initiator |
unfreeze_balance | int64 | Amount of TRX to be unstaked (in SUN, the amount must be ≤ the staked amount) |
resource | ResourceCode | Target resource type (0=Bandwidth, 1=Energy, 2=Vote Power) |
Core Rules
-
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.
-
Resource Returning Calculation
Resource Type Unstaking Impact Bandwidth Immediately reduces the available Bandwidth quota (calculated based on the proportion of unstaked TRX). Energy Updates 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Address 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 Name | Type | Description |
---|---|---|
owner_address | bytes | Address of the operation initiator |
Core Mechanism
-
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.
- Revokes all unstaking requests initiated via
-
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.
Updated about 20 hours ago