Transaction Info
Query and intelligently decode TRON transactions — result status, confirmation, resource consumption, decoded method calls, internal transactions, event logs, and failure diagnosis.
MCP Server
Instructions
Step 1: Fetch Transaction Data
Run two complementary calls in parallel:
- 1.
getTransactionById — Type, raw data, sender/receiver, contract parameters, signatures, timestamp, expiration - INLINECODE1 — Result (SUCCESS/FAILED/REVERT), block number/timestamp, fee, energy/bandwidth usage, contract return value, internal txs, event logs
Step 2: Check Confirmation Status
- 1.
getBlock (no params) — Get current block height - Compare transaction's block number with latest block
- INLINECODE3 — Check if confirmed by solidity node (irreversible)
Classification:
- - Confirmed (Irreversible): Found on solidity node
- Confirmed (Not yet irreversible): In recent block, not solidified
- Pending: Use
getTransactionFromPending if needed - Not Found: Invalid hash or expired
Step 3: Decode Transaction Type
| Contract Type | Description | Key Fields |
|---|
| TransferContract | TRX transfer | from, to, amount |
| TransferAssetContract |
TRC-10 transfer | from, to, asset, amount |
| TriggerSmartContract | Contract call | contract, data (method + params) |
| FreezeBalanceV2Contract | Stake 2.0 freeze | owner, amount, resource |
| UnfreezeBalanceV2Contract | Stake 2.0 unfreeze | owner, amount, resource |
| DelegateResourceContract | Resource delegation | from, to, resource, amount |
| VoteWitnessContract | SR voting | owner, votes list |
| CreateSmartContract | Contract deployment | owner, bytecode, ABI |
Step 4: Decode Smart Contract Calls
For TriggerSmartContract:
- 1. Extract method signature (first 4 bytes of data)
- Common signatures:
-
a9059cbb =
transfer(address,uint256)
-
095ea7b3 =
approve(address,uint256)
-
23b872dd =
transferFrom(address,address,uint256)
- 3. If ABI available (via
getContract), fully decode method name, parameters, and return value - Decode event logs for what actually happened
Step 5: Analyze Resource Consumption
From receipt, break down:
- - Energy: Used amount, from staking vs. burned TRX
- Bandwidth: Used amount, free vs. staked
- Fee: Total TRX paid (divide by 1,000,000 for TRX)
- Energy Penalty: Over-usage penalty if applicable
Step 6: Internal Transactions
Call getInternalTransactionsByTxId for:
- - TRX transfers between contracts
- Contract-to-contract calls
- Token distributions in complex transactions
Step 7: Parse Event Logs
Decode to human-readable descriptions:
- - Transfer → "[amount] [token] from [A] to [B]"
- Approval → "[A] approved [B] to spend [amount]"
- Swap → "[A] swapped [X] tokenA for [Y] tokenB"
Step 8: Compile Transaction Report
CODEBLOCK0
Error Handling
| Error | Cause | Resolution |
|---|
| Transaction not found | Invalid hash, too old, or not yet broadcast | Verify hash format (64 hex chars); check pending pool with INLINECODE14 |
| No receipt data |
Transaction still pending | Note "Transaction pending, receipt not yet available" |
| Cannot decode method | No ABI available for contract | Show raw data hex, identify common method signatures manually |
| REVERT without reason | Contract reverted without error message | Check energy limit, parameter validity, and contract state |
Examples
交易信息
查询并智能解码TRON交易——结果状态、确认情况、资源消耗、解码后的方法调用、内部交易、事件日志及失败诊断。
MCP服务器
操作说明
第一步:获取交易数据
并行执行两个互补调用:
- 1. getTransactionById — 类型、原始数据、发送方/接收方、合约参数、签名、时间戳、过期时间
- getTransactionInfoById — 结果(成功/失败/回滚)、区块编号/时间戳、手续费、能量/带宽使用量、合约返回值、内部交易、事件日志
第二步:检查确认状态
- 1. getBlock(无参数)— 获取当前区块高度
- 将交易所在区块编号与最新区块进行比较
- solidityGetTransactionById — 检查是否已被Solidity节点确认(不可逆)
分类:
- - 已确认(不可逆):在Solidity节点上找到
- 已确认(尚未不可逆):在近期区块中,尚未固化
- 待处理:如有需要,使用getTransactionFromPending
- 未找到:无效哈希或已过期
第三步:解码交易类型
| 合约类型 | 描述 | 关键字段 |
|---|
| TransferContract | TRX转账 | 发送方、接收方、金额 |
| TransferAssetContract |
TRC-10转账 | 发送方、接收方、资产、金额 |
| TriggerSmartContract | 合约调用 | 合约、数据(方法+参数) |
| FreezeBalanceV2Contract | Stake 2.0冻结 | 所有者、金额、资源 |
| UnfreezeBalanceV2Contract | Stake 2.0解冻 | 所有者、金额、资源 |
| DelegateResourceContract | 资源委托 | 发送方、接收方、资源、金额 |
| VoteWitnessContract | SR投票 | 所有者、投票列表 |
| CreateSmartContract | 合约部署 | 所有者、字节码、ABI |
第四步:解码智能合约调用
对于TriggerSmartContract:
- 1. 提取方法签名(数据的前4个字节)
- 常见签名:
- a9059cbb = transfer(address,uint256)
- 095ea7b3 = approve(address,uint256)
- 23b872dd = transferFrom(address,address,uint256)
- 3. 如果有ABI(通过getContract获取),完整解码方法名称、参数和返回值
- 解码事件日志以了解实际发生的情况
第五步:分析资源消耗
从收据中分解:
- - 能量:使用量,来自质押与燃烧的TRX
- 带宽:使用量,免费与质押
- 手续费:支付的总TRX(除以1,000,000得到TRX)
- 能量惩罚:如适用,超额使用惩罚
第六步:内部交易
调用getInternalTransactionsByTxId获取:
- - 合约之间的TRX转账
- 合约到合约的调用
- 复杂交易中的代币分发
第七步:解析事件日志
解码为人类可读的描述:
- - 转账 → [金额] [代币] 从 [A] 到 [B]
- 授权 → [A] 授权 [B] 使用 [金额]
- 兑换 → [A] 用 [X] tokenA 兑换了 [Y] tokenB
第八步:编译交易报告
交易:[txid]
状态
- - 结果:[成功 / 失败 / 回滚]
- 确认:[不可逆 / 已确认 / 待处理]
- 区块:#[编号]([时间戳])
参与方
- - 发送方:[地址]
- 接收方:[地址 / 合约]
- 金额:[金额] TRX / [代币]
解码操作
[人类可读描述]
例如:从 TXxx... 转账 1,000 USDT 到 TYyy...
例如:质押 10,000 TRX 获取能量(Stake 2.0)
资源消耗
- - 能量:[数量](质押:[X],燃烧:[Y])
- 带宽:[数量]
- 总手续费:[数量] TRX
内部交易
| 发送方 | 接收方 | 金额 | 备注 |
|------|----|-------|------|
事件
[解码后的事件日志]
失败分析(如失败)
- - 回滚原因:[解码后]
- 可能原因:[分析]
- 建议:[可操作的修复方案]
错误处理
| 错误 | 原因 | 解决方案 |
|---|
| 交易未找到 | 无效哈希、过于陈旧或尚未广播 | 验证哈希格式(64个十六进制字符);使用getTransactionFromPending检查待处理池 |
| 无收据数据 |
交易仍在处理中 | 注明交易待处理,收据尚不可用 |
| 无法解码方法 | 合约无可用ABI | 显示原始数据十六进制,手动识别常见方法签名 |
| 无原因回滚 | 合约回滚但无错误信息 | 检查能量限制、参数有效性和合约状态 |
示例