Skip to main content
Schema: tron.core Table: dim_contracts Type: Base Table

What

This table provides metadata for smart contracts deployed on the Tron blockchain. It includes contract names, symbols, decimals, and deployment details. Token metadata (name, symbol, decimals) is read directly from the contract when available.

Key Use Cases

  • Identifying contracts by name, symbol, or address
  • Understanding TRC-20 token properties (decimals, symbols)
  • Tracking contract deployment patterns and trends
  • Finding contracts deployed by specific deployers or factories
  • Enriching other tables with contract metadata

Important Relationships

  • Join with fact_transactions: Use address = to_address for contract interactions
  • Join with fact_event_logs: Use address = contract_address for contract events
  • Join with ez_token_transfers: Use address = contract_address for token metadata

Commonly-used Fields

  • address: The deployed contract’s blockchain address (0x hex, lowercase)
  • name: Human-readable contract name from the name() function
  • symbol: Token symbol from the symbol() function (e.g., USDT)
  • decimals: Number of decimal places for token amounts
  • creator_address: Address that deployed this contract
  • created_block_timestamp: When the contract was created

Sample queries

-- Find TRC-20 tokens by name
SELECT
    address,
    name,
    symbol,
    decimals,
    created_block_timestamp,
    creator_address
FROM tron.core.dim_contracts
WHERE name ILIKE '%tether%'
    OR symbol = 'USDT'
ORDER BY created_block_timestamp DESC;

-- Analyze contract deployment trends
SELECT
    DATE_TRUNC('week', created_block_timestamp) AS week,
    COUNT(*) AS contracts_deployed,
    COUNT(DISTINCT creator_address) AS unique_deployers
FROM tron.core.dim_contracts
WHERE created_block_timestamp >= CURRENT_DATE - 90
GROUP BY 1
ORDER BY 1 DESC;

Columns

Column NameData TypeDescription
ADDRESSTEXTThe deployed contract’s blockchain address, in 0x-prefixed hex format (lowercase). Example: ‘0xa614f803b6fd780986a42c78ec9c7f77e6ded13c’
SYMBOLTEXTToken symbol from the symbol() function. NULL if not a token or metadata unavailable. Example: ‘USDT’
NAMETEXTHuman-readable contract name from the name() function. NULL if not a token or metadata unavailable. Example: ‘Tether USD’
DECIMALSNUMBERNumber of decimal places for token amounts, read directly from the contract. TRX uses 6 decimals; most TRC-20 tokens use 18. NULL if not a token or metadata unavailable. Example: 6
CREATED_BLOCK_NUMBERNUMBERBlock number when the contract was created. Example: 54200000
CREATED_BLOCK_TIMESTAMPTIMESTAMP_NTZTimestamp when the contract was created. Example: 2023-06-15 14:30:00.000
CREATED_TX_HASHTEXTTransaction hash of the contract deployment. Example: ‘0x4f01db1f857e711af502ad6fa8b5b3ccd9e36b5f8c8a7b2c1d3e4f5a6b7c8d9e’
CREATOR_ADDRESSTEXTAddress that deployed this contract (transaction from_address), in 0x-prefixed hex format. Example: ‘0x95ba4cf87d6723ad9c0db21737d862be80e93911’
DIM_CONTRACTS_IDTEXTPrimary key — unique identifier for each row ensuring data integrity. Format: VARCHAR containing composite key generated using MD5 hash of the relevant columns. Usage: Deduplication in incremental loads Join operations for data quality checks Troubleshooting specific records
INSERTED_TIMESTAMPTIMESTAMP_LTZUTC timestamp when the record was first added to the Flipside database. Format: TIMESTAMP_NTZ Use Cases: Data freshness monitoring Incremental processing markers Debugging data pipeline issues
MODIFIED_TIMESTAMPTIMESTAMP_LTZUTC timestamp of the most recent update to this record. Format: TIMESTAMP_NTZ Use Cases: Tracking data corrections and reprocessing Monitoring incremental model updates Data quality audits