Contract Analysis
Perform deep analysis of TRON smart contracts — deployment details, method signatures, call patterns, top callers, energy economics, and safety risk assessment.
MCP Server
Instructions
Step 1: Fetch Contract Basics
Run in parallel:
getContractInfo — Contract name, deployer (origin_address), consume_user_resource_percent, origin_energy_limit, creation time, energy usage stats
getContract — Full ABI definition, bytecode, whether ABI is available (indicates open-source status)
Step 2: Parse Contract Methods
From the ABI, categorize all methods:
- Read-only (view/pure): Safe calls, no state changes
- State-changing: transfers, approvals, settings
- Admin/Owner: privileged ops (mint, pause, blacklist, upgrade)
- Events: what the contract logs
Identify standard interfaces: TRC-20, TRC-721, TRC-1155, proxy/upgradeable patterns.
Step 3: Analyze Transaction Activity
getContractTransactions — Total count, recent patterns, success/failure rate
getEventsByContractAddress — Most frequent events, parameter patterns
getContractInternalTransactions — Inter-contract calls, TRX transfers within execution
Step 4: Identify Top Callers
From transaction data, aggregate:
- Top 5 by transaction count
- Top 5 by value (TRX or token amount)
- Classify callers: exchange, bot, regular user, other contract
Step 5: Estimate Energy Costs
Call estimateEnergy with common method calls to assess:
- Typical energy cost per transaction type
- Whether the contract is energy-efficient
- Cost split between user and contract owner (based on
consume_user_resource_percent)
Step 6: Safety Assessment
High Risk indicators:
- No ABI (unverified/closed source)
- Unlimited mint capability
- Pause/freeze can lock user funds
- Blacklist function, self-destruct, hidden transfer fees
- Proxy pattern (upgradeable logic)
consume_user_resource_percent = 100 (users pay all energy)
Medium Risk indicators:
- Very few unique callers vs. high tx count
- Recently created with sudden high activity
- Admin functions without timelock/multisig
Positive indicators:
- Open-source verified, standard implementation
- Timelock on admin functions, multisig requirements
- Long history with consistent activity, diverse callers
Step 7: Compile Contract Report
## Contract Analysis: [address]
### Deployment
- Name: [name] | Deployer: [address]
- Deployed: [date] | Open Source: [Yes/No]
- Standard: [TRC-20/TRC-721/Custom]
### Methods
- Total: [count] (Read: [X], Write: [Y], Admin: [Z])
### Top Methods (by call frequency)
| Method | Calls | Avg Energy |
|--------|-------|------------|
| transfer() | XX,XXX | X,XXX |
### Top Callers
| Address | Tx Count | Label |
|---------|----------|-------|
| TXxx... | X,XXX | [Exchange/Bot/Unknown] |
### Activity
- Total Txs: [count] | Daily Avg: [count]
- Success Rate: [X.X%] | Unique Callers: [count]
### Energy Economics
- User Pays: [X%] | Avg Energy/Tx: [amount]
### Safety Score: [Safe / Caution / High Risk]
- Risk Factors: [list]
- Positive Factors: [list]
- Recommendation: [actionable advice]
Error Handling
| Error |
Cause |
Resolution |
| No ABI found |
Contract not verified or ABI cleared |
Note as unverified; analyze bytecode patterns and transaction data instead |
| Address is not a contract |
Regular account address provided |
Inform user this is a regular account, suggest using trongrid-account-profiling skill |
| No transactions |
Newly deployed or unused contract |
Report as inactive; check deployer's other contracts for context |
| Contract self-destructed |
Contract no longer exists on-chain |
Inform user; historical tx data may still be available |
Examples
- Analyze USDT contract
- Check contract safety
1---2name: trongrid-contract-analysis3description: Analyze TRON smart contracts including deployment info, ABI methods, transaction patterns, top callers, energy costs, and safety assessment. Use when a user asks about a smart contract, wants to verify contract safety, check what a contract does, identify top callers, or detect potential scams. Covers TRC-20/TRC-721 identification, open-source verification, and risk scoring.4---56# Contract Analysis78Perform deep analysis of TRON smart contracts — deployment details, method signatures, call patterns, top callers, energy economics, and safety risk assessment.910# MCP Server11- **Prerequisite**: [TronGrid MCP Guide](https://developers.tron.network/reference/mcp-api)1213## Instructions1415### Step 1: Fetch Contract Basics1617Run in parallel:18191. `getContractInfo` — Contract name, deployer (origin_address), `consume_user_resource_percent`, `origin_energy_limit`, creation time, energy usage stats202. `getContract` — Full ABI definition, bytecode, whether ABI is available (indicates open-source status)2122### Step 2: Parse Contract Methods2324From the ABI, categorize all methods:2526- **Read-only** (view/pure): Safe calls, no state changes27- **State-changing**: transfers, approvals, settings28- **Admin/Owner**: privileged ops (mint, pause, blacklist, upgrade)29- **Events**: what the contract logs3031Identify standard interfaces: TRC-20, TRC-721, TRC-1155, proxy/upgradeable patterns.3233### Step 3: Analyze Transaction Activity34351. `getContractTransactions` — Total count, recent patterns, success/failure rate362. `getEventsByContractAddress` — Most frequent events, parameter patterns373. `getContractInternalTransactions` — Inter-contract calls, TRX transfers within execution3839### Step 4: Identify Top Callers4041From transaction data, aggregate:42- Top 5 by transaction count43- Top 5 by value (TRX or token amount)44- Classify callers: exchange, bot, regular user, other contract4546### Step 5: Estimate Energy Costs4748Call `estimateEnergy` with common method calls to assess:49- Typical energy cost per transaction type50- Whether the contract is energy-efficient51- Cost split between user and contract owner (based on `consume_user_resource_percent`)5253### Step 6: Safety Assessment5455**High Risk indicators:**56- No ABI (unverified/closed source)57- Unlimited mint capability58- Pause/freeze can lock user funds59- Blacklist function, self-destruct, hidden transfer fees60- Proxy pattern (upgradeable logic)61- `consume_user_resource_percent = 100` (users pay all energy)6263**Medium Risk indicators:**64- Very few unique callers vs. high tx count65- Recently created with sudden high activity66- Admin functions without timelock/multisig6768**Positive indicators:**69- Open-source verified, standard implementation70- Timelock on admin functions, multisig requirements71- Long history with consistent activity, diverse callers7273### Step 7: Compile Contract Report7475```76## Contract Analysis: [address]7778### Deployment79- Name: [name] | Deployer: [address]80- Deployed: [date] | Open Source: [Yes/No]81- Standard: [TRC-20/TRC-721/Custom]8283### Methods84- Total: [count] (Read: [X], Write: [Y], Admin: [Z])8586### Top Methods (by call frequency)87| Method | Calls | Avg Energy |88|--------|-------|------------|89| transfer() | XX,XXX | X,XXX |9091### Top Callers92| Address | Tx Count | Label |93|---------|----------|-------|94| TXxx... | X,XXX | [Exchange/Bot/Unknown] |9596### Activity97- Total Txs: [count] | Daily Avg: [count]98- Success Rate: [X.X%] | Unique Callers: [count]99100### Energy Economics101- User Pays: [X%] | Avg Energy/Tx: [amount]102103### Safety Score: [Safe / Caution / High Risk]104- Risk Factors: [list]105- Positive Factors: [list]106- Recommendation: [actionable advice]107```108109## Error Handling110111| Error | Cause | Resolution |112|-------|-------|------------|113| No ABI found | Contract not verified or ABI cleared | Note as unverified; analyze bytecode patterns and transaction data instead |114| Address is not a contract | Regular account address provided | Inform user this is a regular account, suggest using trongrid-account-profiling skill |115| No transactions | Newly deployed or unused contract | Report as inactive; check deployer's other contracts for context |116| Contract self-destructed | Contract no longer exists on-chain | Inform user; historical tx data may still be available |117118## Examples119120- [Analyze USDT contract](examples/analyze-usdt-contract.md)121- [Check contract safety](examples/check-contract-safety.md)