# Local Event Indexer

The Flow local event indexer is available on github and docker and can be used during development before set up your Graffle projects. It is a trimmed down version of the event indexers on the Projects page within the Graffle management dashboard.\
\
<https://hub.docker.com/r/graffle/flow-event-processor>\
<https://github.com/Graffle/flow-event-processor>\
\
We recommend using the Docker image and running the local indexer using docker, but you can pull the code from GitHub and debug it in your IDE or run it with docker-compose.

### Configuration

* FlowNode: MainNet, TestNet, or Emulator. Note: Emulator support is currently limited to running from VS Code.
* MaximumBlockScanRange: Block size to scan when catching up after falling behind, should normally be set to 200.
* WebhookUrl: Your url which will receive POST requests containing your processed events.
* EventId: Flow event Id of the event type you want to process. ex: A.c1e4f4f4c4257510.Market.MomentPurchased
* Verbose: Log found events to the console when posting to WebhookUrl.
* HMACToken: Base-64 encoded string for HMAC authentication headers.

### Docker

```
docker pull graffle/flow-event-processor
```

#### TestNet

```
docker run -e "FlowNode=TestNet" -e "WebhookUrl=url" -e "EventId=A.c1e4f4f4c4257510.TopShotMarketV3.MomentPurchased" graffle/flow-event-processor
```

#### MainNet

```
docker run -e "FlowNode=MainNet" -e "WebhookUrl=url" -e "EventId=A.c1e4f4f4c4257510.TopShotMarketV3.MomentPurchased" graffle/flow-event-processor
```

{% hint style="info" %}
Note: When using the HMAC variable to set a token, this application always adds the following headers to the request.\
\
x-graffle-company-id: 00000000-0000-0000-0000-000000000000 \
x-graffle-project-id: 00000000-0000-0000-0000-000000000000\
\
See "Securing Indexer Webhooks" for information about decoding/validating HMAC auth headers.
{% endhint %}

### Docker-Compose

Create a .env.local file in the root of your repository, next to docker-compose.yml:

```
WEBHOOKURL=https://<your url>
EVENTID=A.c1e4f4f4c4257510.Market.MomentPurchased
VERBOSE=true
HMACTOKEN=[base64 string]
```

Open a terminal window in the root of your repository and run one of the following:

```
 docker-compose build test_net_graffle_flow_event_processor
 docker-compose --env-file .\.env.local up test_net_graffle_flow_event_processor
```

```
 docker-compose build main_net_graffle_flow_event_processor
 docker-compose --env-file .\.env.local up main_net_graffle_flow_event_processor
```

for test net or main net event processing.


---

# 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.graffle.io/graffle-docs/open-source/local-event-indexer.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.
