EVM Chain Logs

The application allows you to query your data sources and build dashboards to visualize data. If you're working with Ethereum Virtual Machine (EVM) based blockchains, it's possible to directly query logs and function calls from the Ethereum chain using the EVM Logs data source type. Here is a detailed guide on how to use it.

1. Add Data Source

  • Go to the application's home page.

  • Click on the Data Sources tab on the left sidebar.

  • Click on the New Data Source button at the top right corner of the page.

  • In the list of data source types, look for EVMLogs and select it.

2. Configure Data Source

Once you've selected EVMLogs, you'll be asked to provide two essential pieces of information:

  • Ethereum RPC URL: This is the URL to an Ethereum node's RPC (Remote Procedure Call) interface. If you're running your own Ethereum node, this URL will typically be http://localhost:8545 or http://127.0.0.1:8545. If you're using a hosted Ethereum node provider like Infura, Alchemy, or QuickNode, they will provide this URL for you.

  • Etherscan API Key: This is your API key for Etherscan, a popular Ethereum blockchain explorer. You'll need to sign up on the Etherscan website to get an API key.

After entering these, click the Add button at the bottom of the page to add this data source.

3. Write a Query

Now that you've configured the EVM Logs data source, you can write a query to fetch the Ethereum logs or function calls. To do this, click on the Queries tab on the left sidebar and then click on New Query.

A query for this data source should be written in YAML format, as shown below:

contract_address: 0xYourContractAddressHere
event_name: YourEventNameHere
start_block: YourStartBlockHere
end_block: YourEndBlockHere
  • contract_address: Replace 0xYourContractAddressHere with the Ethereum address of the smart contract whose logs you want to fetch.

  • event_name: Replace YourEventNameHere with the name of the event logs you're interested in. This should be an event that the smart contract can emit.

  • start_block and end_block: Replace YourStartBlockHere and YourEndBlockHere with the range of Ethereum blocks you want to fetch logs from. These should be numbers. If you want to fetch logs from the latest block, you can use the keyword latest.

You can also fetch Ethereum function calls by using the function_name parameter, as shown below:

contract_address: 0xYourContractAddressHere
function_name: YourFunctionNameHere
start_block: YourStartBlockHere
end_block: YourEndBlockHere
  • function_name: Replace YourFunctionNameHere with the name of the function call you're interested in. This should be a function that the smart contract can call.

4. Execute the Query

Once you've written your query, you can execute it by clicking on the Execute button at the top right corner of the query editor.

After executing the query, the results will be displayed in the bottom section of the query editor. You can now create a visualization or a dashboard from this data.

5. Create Visualizations and Dashboards

The application allows you to create a variety of visualizations such as charts, graphs, tables, pivot tables, maps, and more from your query results. After creating visualizations, you can arrange them on a dashboard and share them with your team.

This allows you to quickly gain insights from Ethereum logs and function calls without needing to write complex scripts or manually trawl through blockchain data.

Enjoy exploring your EVM chain logs with the application!

6. Specifying Block Numbers

In your YAML query, you're asked to specify the start_block and end_block. This is the range of blocks that you want to fetch the logs or function calls from. Here's how you can define them:

  • Absolute block numbers: You can directly input the block numbers. For instance, start_block: 1000 and end_block: 2000 will fetch logs from block 1000 to 2000.

  • Relative block numbers with a negative number for the start_block: If you input a negative number for the start_block, it will count back that many blocks from the end_block. For example, start_block: -1000 and end_block: 2000 will fetch logs from block 1000 (2000 - 1000) to block 2000.

  • The latest keyword for the end_block: If you use the keyword latest for the end_block, it will fetch logs up to the most recently mined block. For instance, start_block: 1000 and end_block: latest will fetch logs from block 1000 to the latest block.

7. Importance of Specifying a Reasonable Range of Blocks

While it can be tempting to fetch logs from a wide range of blocks, it's important to be mindful of the resources that this consumes. Querying data from the Ethereum blockchain requires computational resources, both from the Ethereum node that you're fetching data from and from the application server that's processing the data.

Fetching logs from a large number of blocks can take a long time and consume a lot of resources. This can slow down your server and also put unnecessary load on the Ethereum node.

In addition, if you're using a hosted Ethereum node provider that charges based on usage, fetching data from a large number of blocks can also be expensive.

Therefore, it's recommended to fetch logs from a reasonable range of blocks that's aligned with your requirements. Start with a smaller range of blocks and gradually increase it if necessary, while monitoring the resource usage.

And remember, the application allows you to save and reuse your queries, so you can easily run the same query on a different range of blocks as needed.

Last updated