> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dune.com/llms.txt
> Use this file to discover all available pages before exploring further.

# tron.logs

> Tron smart contract event logs — topics and data from TRC-20 transfers and protocol interactions.

export const TableSample = ({tableName, tableSchema}) => <>
    <div className="hidden dark:block">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}&darkMode=true`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
    <div className="dark:hidden">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
  </>;

## Table Description

The `tron.logs` table represents the logs generated by the Tron Virtual Machine (TVM) when a contract is executed. Logs are a way to store data on the blockchain. Logs originate from events that occur during the execution of a smart contract. A log consists of:

* topic list: a list of 0 to 4 32-byte data topics. `Topic0` is the hash of the signature of the event (indexed), and the remaining topics are indexed parameters of the event.
* data: contains non-indexed data.

While working with raw logs is possible, we recommend to work with [decoded logs](../decoded/event-logs) for a more user-friendly experience.

## Table Schema

| Column            | Type         | Description                                                                          |
| ----------------- | ------------ | ------------------------------------------------------------------------------------ |
| block\_time       | timestamp(3) | The exact UTC timestamp when the block containing this log was added to the chain    |
| block\_number     | bigint       | The sequential number of the block containing this log                               |
| block\_hash       | varbinary    | Unique identifier (hash) of the block containing this log                            |
| contract\_address | varbinary    | Address of the smart contract that emitted this log                                  |
| topic0            | varbinary    | First 32-byte topic, typically the keccak256 hash of the event signature             |
| topic1            | varbinary    | Second 32-byte topic, containing the first indexed event parameter                   |
| topic2            | varbinary    | Third 32-byte topic, containing the second indexed event parameter                   |
| topic3            | varbinary    | Fourth 32-byte topic, containing the third indexed event parameter                   |
| data              | varbinary    | ABI-encoded data containing non-indexed event parameters                             |
| tx\_hash          | varbinary    | Unique identifier (hash) of the transaction that generated this log                  |
| index             | integer      | Position of this log within the block                                                |
| tx\_index         | integer      | Position of the parent transaction within its containing block                       |
| block\_date       | date         | The UTC date of the block in which this log was included                             |
| tx\_from          | varbinary    | Address of the account that initiated the transaction containing this log            |
| tx\_to            | varbinary    | Address of the recipient account or contract for the transaction containing this log |

## Table Sample

<TableSample tableSchema="tron" tableName="logs" />

## Examples

### Filter the logs for a specific contract

```sql theme={null}
select *
from tron.logs
where contract_address = 0x06012c8cf97bead5deae237070f9587f8e7a266d
limit 10
```

### Filter the logs for a specific topic

```sql theme={null}
select *
from tron.logs
where topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef

```

### Show the logs of a specific block

```sql theme={null}
SELECT *
FROM tron.logs
WHERE evt_block_number = 1000000
```
