LogoLogo
Package RegistryThe Graph
  • Introduction
  • Getting Started
  • Tutorials
    • Develop Your First Substreams
      • on EVM
      • on Solana
        • Transactions & Instructions
        • Account Changes
      • on Cosmos
        • Injective
        • MANTRA
      • on Starknet
      • on Stellar
    • Publishing a Substreams Package
  • How-To Guides
    • Developing Substreams
      • on EVM
        • Exploring Ethereum
          • Mapping Blocks
          • Filter Transactions
          • Retrieve Events of a Smart Contract
      • on Solana
        • Explore Solana
          • Filter Instructions
          • Filter Transactions
        • SPL Token Tracker
        • NFT Trades
        • DEX Trades
      • on Cosmos
        • Injective
          • Simple Substreams Example
          • Foundational Modules
          • Dojo DEX USDT Volume Subgraph Example
    • Using a Substreams Sink
      • Substreams:SQL
      • Substreams:Subgraph
        • Triggers
        • Graph Out
      • Substreams:Stream
        • JavaScript
        • Go
      • Substreams:PubSub
      • Community Sinks
        • MongoDB
        • Files
        • Key-Value Store
        • Prometheus
    • EVM Extensions
      • Making eth_calls
    • Getting Started Using Rust and Protobuf
      • Rust
        • Option struct
        • Result struct
      • Protobuf Schemas
    • From Yellowstone to Substreams
  • Reference Material
    • Chains and endpoints
      • Ethereum Data Model
    • Never Miss Data
    • Development Container Reference
    • Substreams CLI
      • Install the CLI
      • Authentication
      • Substreams CLI reference
    • Substreams Components
      • Packages
      • Modules
        • Module types
        • Inputs
        • Output
        • Module handlers
        • Module handler creation
        • Indexes
        • Keys in stores
        • Dynamic data sources
        • Aggregation Windows
        • Parameterized Modules
      • Manifests Reference
    • Substreams Architecture
    • Graph-Node
      • Local Development
      • Publish to The Graph Network
    • Indexer Reference
      • Test Substreams Locally
    • Logging, Debugging & Testing
    • Change log
    • FAQ
  • Decentralized Indexing
    • What is The Graph?
Powered by GitBook
On this page
  • The GitHub Repository
  • Substreams Basics
  • Ethereum Explorer
  • Modules
  • The Project Structure
  • Additional Resources
  • Substreams Components Reference

Was this helpful?

Edit on GitHub
  1. How-To Guides
  2. Developing Substreams
  3. on EVM

Exploring Ethereum

Previouson EVMNextMapping Blocks

Last updated 5 months ago

Was this helpful?

Getting started with Substreams might feel challenging, but you are not alone! The Substreams Explorers are a set of projects, modules, and code samples that allow you to explore and discover the main features of Substreams.

Tip: This tutorial teaches you how to build a Substreams from scratch.

Remember that you can auto-generate a filtered Substreams module by using the .

The Ethereum block model for Substreams is represented by the Rust struct.

Before moving forward, make sure to reference the minimal path within the .

The GitHub Repository

The https://github.com/streamingfast/substreams-explorers GitHub repository contains all the Substreams Explorers currently available. You can simply clone the repository:

git clone https://github.com/streamingfast/substreams-explorers

Substreams Basics

You should be familiar with the basic Substreams terminology, which includes:

  • Modules (understanding the difference between a map and a store module)

  • Protobufs (understanding what they are)

Ethereum Explorer

The Ethereum Explorer consists of several Substreams modules showcasing the most basic operations that you can perform with Substreams on the Ethereum blockchain.

You can find the Ethereum Explorer at

Modules

The modules in this repository answer some interesting questions when developing a blockchain application:

How Can You Get the Basic Information of a Block?

For every block, the map_block_meta module retrieves the most relevant information of the block (number, hash, and parent hash).

How Can You Retrieve Transactions By Their From or To Fields?

Given any combination of two parameters (from and to), the map_filter_transactions filters a transaction among all transactions in the blockchain. This involves:

  1. Providing the filters (only the from fields, only the to field, both from and to fields, or none)

  2. Iterating over all the transactions.

  3. Filtering the transactions, according to the parameters provided. For example, from == tx_from, from == tx_from and to == tx_to.

How Can You Retrieve All the Events For a Specific Smart Contract?

Given a smart contract address parameter (contract_address), the map_contract_events module retrieves all the events related to a specific smart contract. This involves:

  1. Iterating over all the logs of a block.

  2. Filtering the log, where the address field is equal to the smart contract address parameter (address == contract_address).

In the following sections, you will go through every module, run the corresponding Substreams, and understand every piece of code. Let's go!

The Project Structure

  1. The proto folder contains the Protobuf definitions for the transformations. In this example, there are three Protobuf objects, which are the outputs of the Substreams module mentioned in the previous section: BlockMeta (which represents the information of an Ethereum block), Transaction (which is an abstraction for an Ethereum transaction), and Event (an abstraction for an Ethereum event).

  2. The src folder contains the source code of the Substreams transformations. Every module has its corresponding Rust file.

  3. The substreams.yml is the Substreams manifest, which defines relevant information, such as the inputs/outputs of every module or the Protobuf files.

The Substreams Manifest

Let's take a closer look at the Substreams manifest (substreams.yml):

  1. The protobuf section specifies the location of the Protobuf files used in the Substreams (i.e. where are the files defining the objects that you are going to use as output). In this example, the files are under the proto folder.

  2. When you run Substreams, you are really executing a Rust application inside a WASM container. Therefore, Substreams needs to know where is the WASM executable. The binaries section specifies the location of the WASM executable.

Additional Resources

You may find these additional resources helpful for developing your first Solana application.

Substreams Components Reference

Every module must be defined in the manifest, along with its kind, inputs and outputs. In this example, the map_block_meta module is a mapper that takes a raw Ethereum block as input () and outputs the BlockMeta protobuf. Basically, the map_block_meta module returns a reduced version of the Ethereum block.

The lets you explore all the tools available in the Substreams CLI.

The dives deeper into navigating the substreams.yaml.

code-generation tools
sf.ethereum.type.v2.Block
Dev Container
https://github.com/streamingfast/substreams-explorers
sf.ethereum.type.v2.Block
CLI reference
Components Reference
Ethereum Explorer Project Structure
Ethereum Explorer Manifest