# Exploring Ethereum

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.

{% hint style="success" %}
**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 [code-generation tools](/tutorials/intro-to-tutorials/evm.md).
{% endhint %}

The Ethereum block model for Substreams is represented by the [`sf.ethereum.type.v2.Block`](https://github.com/streamingfast/firehose-ethereum/blob/develop/proto/sf/ethereum/type/v2/type.proto) Rust struct.

Before moving forward, make sure to reference the minimal path within the [Dev Container](https://github.com/streamingfast/substreams-starter).

### 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 <https://github.com/streamingfast/substreams-explorers>

### 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

<figure><img src="/files/ePkYON0cRGZ3DNIikkpf" alt=""><figcaption><p>Ethereum Explorer Project Structure</p></figcaption></figure>

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`):

<figure><img src="/files/pgUSsVCN1yRjGK7WRPlN" alt="" width="100%"><figcaption><p>Ethereum Explorer Manifest</p></figcaption></figure>

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.
3. 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 ([`sf.ethereum.type.v2.Block`](https://github.com/streamingfast/firehose-ethereum/blob/develop/proto/sf/ethereum/type/v2/type.proto)) and outputs the `BlockMeta` protobuf. Basically, the `map_block_meta` module returns a reduced version of the Ethereum block.

## Additional Resources

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

The [CLI reference](/reference-material/command-line-interface.md) lets you explore all the tools available in the Substreams CLI.

### Substreams Components Reference

The [Components Reference](/reference-material/manifest-and-components/packages.md) dives deeper into navigating the `substreams.yaml`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.substreams.dev/how-to-guides/develop-your-own-substreams/on-evm/exploring-ethereum.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
