Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsTRONTRON HTTP API

wallet/getcontractinfo - Get Contract Details

Get detailed information about a TRON smart contract including bytecode, ABI, and energy consumption via Dwellir's RPC endpoint.

TRON RPC endpoint: endpoint URLs, plans and pricing.

Get detailed information about a deployed smart contract.

Endpoint

Text
POST /wallet/getcontractinfo
cURL request
# Get contract info with visible address
    curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getcontractinfo \
      -H "Content-Type: application/json" \
      -d '{
        "value": "TContractAddress...",
        "visible": true
      }'

    # Get contract info with hex address
    curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getcontractinfo \
      -H "Content-Type: application/json" \
      -d '{
        "value": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c"
      }'

    # Extract ABI using jq
    curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getcontractinfo \
      -H "Content-Type: application/json" \
      -d '{
        "value": "TContractAddress...",
        "visible": true
      }' | jq '.abi.entrys[] | select(.type == "Function") | .name'

Implementation Examples

ABI Entry Types

Function Entry

JSON
{
  "name": "functionName",
  "inputs": [...],
  "outputs": [...],
  "type": "Function",
  "stateMutability": "view|pure|nonpayable|payable"
}

Event Entry

JSON
{
  "name": "EventName",
  "inputs": [
    {
      "indexed": true,
      "name": "param1",
      "type": "address"
    }
  ],
  "type": "Event"
}

Constructor Entry

JSON
{
  "inputs": [...],
  "type": "Constructor",
  "stateMutability": "nonpayable"
}

Contract Verification

JavaScript
// Verify contract source code matches deployed bytecode
async function verifyContract(address, sourceCode, compilerVersion) {
  // Get deployed contract info
  const response = await fetch(`${API_URL}/wallet/getcontractinfo`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ value: address, visible: true })
  });
  
  const contract = await response.json();
  const deployedBytecode = contract.bytecode;
  
  // Compile source code (pseudo-code)
  const compiledBytecode = await compileContract(sourceCode, compilerVersion);
  
  // Compare bytecodes (excluding metadata)
  const verified = compareBytecode(deployedBytecode, compiledBytecode);
  
  return {
    verified,
    contractName: contract.contract_name,
    abi: contract.abi,
    creator: contract.origin_address
  };
}

Best Practices

1. Cache Contract Info

  • ABI doesn't change after deployment
  • Cache to reduce API calls
  • Update cache only when needed

2. Validate Contracts

  • Check bytecode exists
  • Verify ABI structure
  • Confirm expected functions present

3. Energy Monitoring

  • Track consumed_energy growth
  • Monitor for unusual consumption
  • Alert on high energy usage

Common Errors

ErrorDescriptionSolution
Contract does not existInvalid contract addressVerify address is correct
Not a smart contract addressAddress is not a contractCheck address type first
class org.tron.core.exception.BadItemExceptionMalformed requestCheck parameter format

Use Cases

  • Contract Verification: Verify deployed contract matches source
  • ABI Extraction: Get contract interface for interaction
  • DApp Integration: Load contract details dynamically
  • Analytics: Track contract usage and energy consumption
  • Security Auditing: Analyze contract bytecode and functions

Related Methods

  • wallet/triggersmartcontract - Call contract function
  • wallet/triggerconstantcontract - Call view function
  • wallet/estimateenergy - Estimate energy for call

wallet/getcontract

Retrieve TRON smart contract information including bytecode, ABI, and metadata. Essential for contract verification and interaction via Dwellir RPC.

wallet/estimateenergy

Estimate energy consumption for TRON smart contract calls before execution. Optimize transaction costs and resource planning with Dwellir RPC.

On this page

EndpointImplementation ExamplesABI Entry TypesFunction EntryEvent EntryConstructor EntryContract VerificationBest Practices1. Cache Contract Info2. Validate Contracts3. Energy MonitoringCommon ErrorsUse CasesRelated Methods