Transactions
Transaction structure, lifecycle, and the TAPOS replay protection mechanism on TRON.
A transaction is a cryptographically signed instruction from an account that updates the state of the TRON network. The simplest transaction transfers TRX from one account to another. Transactions can also create accounts, deploy and call smart contracts, stake TRX, and submit governance proposals.
To take effect, a transaction is broadcast across the network, validated, included in a block by a Super Representative, and then waits for the containing block to become solidified. This page covers the structure of a transaction, the four lifecycle phases, and the TAPOS mechanism that protects against replay on forks.
Prerequisites
Transaction structure
A transaction has two top-level sections: raw_data (the signed payload) and signature (the proof of authorization).
{
"raw_data": {
"contract": [ /* one contract — see Transaction types below */ ],
"ref_block_bytes": "c145",
"ref_block_hash": "c56bd8a3b3341d9d",
"expiration": 1646796363000,
"data": "74657374",
"timestamp": 1646796304152,
"fee_limit": 10000000000
},
"signature": [
"47b1f77b...8b0a1800"
]
}The fields:
| Field | Description |
|---|---|
raw_data.contract | The operation the transaction requests and its parameters. The list contains exactly one contract today. Different transaction types use different contract bodies — see ContractType |
raw_data.ref_block_bytes | TAPOS — byte interval [6, 8) of the reference block's number, including byte 6 and excluding byte 8. See TAPOS |
raw_data.ref_block_hash | TAPOS — byte interval [8, 16) of the reference block's ID, including byte 8 and excluding byte 16 |
raw_data.expiration | After this Unix timestamp (ms), the transaction is dropped instead of included. Default expiration is +60 seconds; max is 24 hours. See Expiration and timestamps below for the construction logic, config overrides, and the relationship with timestamp |
raw_data.data | An optional memo (hex bytes) |
raw_data.timestamp | Transaction creation time. Optional — the on-chain timestamp is the block's timestamp. See Expiration and timestamps below |
raw_data.fee_limit | Caller-side Energy budget cap in sun for write smart-contract calls — caps the caller's total Energy usage (staked Energy plus the TRX-burn portion), not just the amount burned. Required for smart-contract calls. See FeeLimit & Energy cost for sizing, the Dynamic Energy Model, and per-tool examples |
signature | The sender's ECDSA signature(s) over SHA-256(protobuf_serialize(raw_data)). Each signature is 65 bytes on the wire: r (32) ‖ s (32) ‖ v (1, recovery byte 0 or 1). Multiple signatures appear when account permissions require multi-party authorization |
Transaction types
TRON supports many transaction types — TRX transfers, TRC-10 transfers, smart contract deployment and calls, staking, voting, and proposal submission. Each type uses a different contract body and a different API to construct it. Examples:
| Type | Contract body | API |
|---|---|---|
| TRX transfer | TransferContract | wallet/createtransaction |
| TRC-10 transfer | TransferAssetContract | wallet/transferasset |
| Smart contract deploy | CreateSmartContract | wallet/deploycontract |
| Smart contract call | TriggerSmartContract | wallet/triggersmartcontract |
| Stake TRX | FreezeBalanceV2Contract | wallet/freezebalancev2 |
For the full list of contract types, see Details of supported transaction types.
A transaction's serialized size is bounded — exceeding the chain's TRANSACTION_MAX_BYTE_SIZE limit causes the network to reject it as TooBigTransactionException. This matters mainly for large smart-contract deployments and transactions with deep multi-sig signature lists.
Expiration and timestamps
A transaction carries two time fields in raw_data: expiration and timestamp. Only expiration controls whether the transaction is included — focus on that one. timestamp is a passive record of when the unsigned transaction was built and does not affect inclusion.
raw_data.expiration — the drop-by deadline
raw_data.expiration — the drop-by deadlineexpiration is a hard cutoff in Unix milliseconds. After this timestamp the node drops the transaction instead of including it.
- Default: 60 seconds beyond the latest block's timestamp.
- Maximum: 24 hours.
When a Fullnode builds a transaction, it computes:
expiration = headBlockTimestamp + trx.expiration.timeInMillisecondsThe anchor is the head block's timestamp, not the node's wall-clock. This ties the deadline to chain progress: if the chain is keeping up, the transaction has roughly 60 seconds of "chain time" to land.
trx.expiration.timeInMilliseconds is set in the node's config.conf:
# trx.expiration.timeInMilliseconds = 60000The line ships commented out, so most operators run with the built-in 60-second default.
How to extend or shorten
| Where | Mechanism |
|---|---|
| Node-wide | Stop the node, uncomment the line above in config.conf and set a new value in milliseconds (1 ms – 86,400,000 ms), then restart the node for the change to take effect. Every transaction the node builds afterward uses the new value. |
| Per-transaction | Most mainstream SDKs let you override the expiration on a specific transaction — for example, TronWeb's extendExpiration. The 24-hour ceiling still applies at broadcast. |
Typical reason to extend: large multi-signer flows where the unsigned transaction needs to circulate among signers for more than 60 s before broadcast.
raw_data.timestamp — for reference, not for enforcement
raw_data.timestamp — for reference, not for enforcementtimestamp records the local wall-clock at the moment the node builds the unsigned transaction. It is not used to compute expiration (which is anchored to the head block, not to timestamp), and it is not the authoritative on-chain time for the transaction — that role belongs to the timestamp of the block that includes it. Treat timestamp as a debugging hint ("when did the client build this?"), not a control field. The two fields can drift apart by a few seconds in normal operation and by more under network congestion — don't write client logic that assumes expiration - timestamp == 60_000.
For local signing outside the node and the optional air-gapped workflow, see Signing transactions offline.
TAPOS
TAPOS (Transaction As Proof Of Stake) requires each transaction to reference a recent block. Nodes use this reference to confirm that the transaction is based on recent chain state and to limit replay on branches that do not contain the reference block.
The transaction's ref_block_bytes and ref_block_hash fields together identify the reference block:
| Field | Source | Length |
|---|---|---|
ref_block_bytes | Byte interval [6, 8) of the reference block's number, including byte 6 and excluding byte 8 | 2 bytes |
ref_block_hash | Byte interval [8, 16) of the reference block's ID, including byte 8 and excluding byte 16 | 8 bytes |
An SDK may use the latest block or the latest solidified block as the reference block, depending on the method and configuration.
The 2-byte ref_block_bytes field can address at most 65,536 distinct block numbers (the byte-space ceiling). In practice the validating node looks up reference blocks in its RecentBlockStore; if the reference block was forked away from the canonical chain, or if it has genuinely aged beyond the 65,536-block lookup window, validation fails with TaposException and the transaction is rejected. When constructing a transaction manually, choose a recent solidified block and broadcast within the transaction's expiration window.
For the SDK local-signing and air-gapped signing workflows, see Signing transactions offline.
Transaction lifecycle
A transaction passes through four phases:
- Create and sign — Construct the
raw_datapayload locally and sign with the sender's private key. - Broadcast and validate — Submit to a Fullnode. The node verifies the signature, checks Bandwidth and Energy, and adds the transaction to its mempool.
- Include in a block — When the next scheduled SR produces a block, it pulls transactions from the mempool in order, executes them, and includes them in the new block. The block is broadcast to the rest of the network.
- Solidify — A transaction is fully confirmed when the containing block is solidified — that is, when at least 19 distinct active SRs each have a latest successfully produced block number (
latestBlockNum) greater than or equal to that block number. This typically takes about 1 minute. Before solidification, the transaction is included in a block but may still be removed from the canonical chain by a reorganization.
For the solidification mechanism, see Consensus and DPoS — Block solidification.
Creating a transaction
Most workflows use TronWeb or another SDK to construct, sign, and broadcast a transaction. For details on the signing step, see Signature validation.
The following example transfers 100 sun (0.0001 TRX):
const recipient = process.env.TRON_RECIPIENT_ADDRESS;
const sender = tronWeb.defaultAddress.base58;
if (!tronWeb.isAddress(recipient) || !tronWeb.isAddress(sender)) {
throw new Error("Set valid sender and recipient addresses");
}
const unsignedTxn = await tronWeb.transactionBuilder.sendTrx(
recipient,
100, // amount in sun
sender
);
const signedTxn = await tronWeb.trx.sign(unsignedTxn);
const broadcastResponse = await tronWeb.trx.sendRawTransaction(signedTxn);sendRawTransaction returns the broadcast response, which does not tell you whether the transfer succeeded on-chain. To check the outcome, use the transaction ID (txID) to look up the transaction receipt.
Transaction receipt
After executing a transaction in a block, the node generates a transaction receipt (TransactionInfo) that records the outcome, resource usage, and fees paid.
The result field indicates whether the transaction succeeded. On failure, its value is FAILED; on success, the JSON response may omit it. blockNumber identifies the block containing the transaction. fee is the total fee paid, in sun, and excludes any amount transferred.
Within TransactionInfo, the receipt field records Bandwidth usage, Energy consumed during smart contract execution, and the associated fees. For smart contract transactions, receipt.result reports the TVM execution status, such as SUCCESS or REVERT.
For smart contract transactions, the transaction receipt may also include contract return data (contractResult), event logs (log), and internal transactions (internal_transactions).
Use the same txID with /wallet/gettransactionbyid to check the requested operation and its parameters in the transaction body (Transaction), or with /wallet/gettransactioninfobyid to retrieve the transaction receipt. To check the solidified execution result, use /walletsolidity/gettransactioninfobyid.
APIs
| API | Description |
|---|---|
wallet/createtransaction | Create a TRX transfer transaction |
wallet/broadcasttransaction | Broadcast a signed transaction |
wallet/gettransactionbyid | Look up a transaction by its ID |
wallet/gettransactioninfobyid | Retrieve the transaction receipt, including execution status, resource usage, and logs |
Related resources
- API signature and broadcast flow — transaction construction, signing, broadcast, and confirmation path
- Confirmation semantics — distinguish the broadcast response, receipt, and solidified final state
- Internal transactions — TRX moves triggered inside contract execution
- Signature validation — How signatures are verified
- Signing transactions offline — Sign locally with an SDK or validate and sign on an air-gapped device
- Transfer TRX recipe — End-to-end TRX transfer code
Updated 6 days ago