# Available commands

Memento is comprised of a few commands that will be detailed below.

Summary:

* `run` - the main command; use this to do the scraping and indexing
* `migrate` - the manual version of executing the database migrations
* `reset` - empty the database; use this if you want to start from scratch
* `queue` - manually add a block / an interval of blocks in the todo list

## `run`

```
Track new blocks and index them

Usage:
  memento run [flags]

Flags:
      --api.dev-cors                          Enable development cors for HTTP API
      --api.dev-cors-host string              Allowed host for HTTP API dev cors
      --api.port string                       HTTP API port (default "3001")
      --dashboard.config-management.enabled   Enable/disable the config management option from dashboard (default true)
      --dashboard.port string                 Memento Dashboard port (default "3000")
      --db.connection-string string           Postgres connection string.
      --db.dbname string                      Database name (default "coriolis")
      --db.host string                        Database host (default "localhost")
      --db.port string                        Database port (default "5432")
      --db.sslmode string                     Database sslmode (default "disable")
      --db.user string                        Database user (also allowed via PG_USER env)
      --eth.client.http string                HTTP endpoint of JSON-RPC enabled Ethereum node
      --eth.client.poll-interval duration     Interval to be used for polling the Ethereum node for best block (default 15s)
      --eth.client.ws string                  WS endpoint of JSON-RPC enabled Ethereum node (provide this only if you want to use websocket subscription for tracking best block)
      --feature.automigrate.enabled           Enable/disable the automatic migrations feature (default true)
      --feature.backfill.enabled              Enable/disable the automatic backfilling of data (default true)
      --feature.lag.enabled                   Enable/disable the lag behind feature (used to avoid reorgs)
      --feature.lag.value int                 The amount of blocks to lag behind the tip of the chain (default 10)
      --feature.uncles.enabled                Enable/disable uncles scraping (default true)
  -h, --help                                  help for run
      --redis.list string                     The name of the list to be used for task management (default "todo")
      --redis.server string                   Redis server URL (default "localhost:6379")

Global Flags:
      --config string          /path/to/config.yml
      --logging string         Display debug messages
      --v --logging=*=debug    Set all logging modules to debug (shorthand for --logging=*=debug)
      --vv --logging=*=trace   Set all logging modules to trace (shorthand for --logging=*=trace)
```

**Example run**

```
cp config-sample.yml config.yml
./memento run --vv
```

## `migrate`

```
Manually run the database migrations

Usage:
  memento migrate [flags]

Flags:
      --db.connection-string string   Postgres connection string.
      --db.dbname string              Database name (default "coriolis")
      --db.host string                Database host (default "localhost")
      --db.port string                Database port (default "5432")
      --db.sslmode string             Database sslmode (default "disable")
      --db.user string                Database user (also allowed via PG_USER env)
  -h, --help                          help for migrate
      --migrations-dir string         path to directory containing database migrations (default "./migrations")

Global Flags:
      --config string          /path/to/config.yml
      --logging string         Display debug messages
      --v --logging=*=debug    Set all logging modules to debug (shorthand for --logging=*=debug)
      --vv --logging=*=trace   Set all logging modules to trace (shorthand for --logging=*=trace)
```

**Example run**

```
cp config-sample.yml config.yml
./memento migrate
```

## `reset`

```
Reset the database to an empty state by truncating all the tables

Usage:
  memento reset [flags]

Flags:
      --db.connection-string string   Postgres connection string.
      --db.dbname string              Database name (default "coriolis")
      --db.host string                Database host (default "localhost")
      --db.port string                Database port (default "5432")
      --db.sslmode string             Database sslmode (default "disable")
      --db.user string                Database user (also allowed via PG_USER env)
  -h, --help                          help for reset
      --redis.list string             The name of the list to be used for task management (default "todo")
      --redis.server string           Redis server URL (default "localhost:6379")

Global Flags:
      --config string          /path/to/config.yml
      --logging string         Display debug messages
      --v --logging=*=debug    Set all logging modules to debug (shorthand for --logging=*=debug)
      --vv --logging=*=trace   Set all logging modules to trace (shorthand for --logging=*=trace)
```

**Example run**

```
cp config-sample.yml config.yml
./memento reset
```

## `queue`

```
Manually add a block to the todo queue

Usage:
  memento queue [flags]

Flags:
      --block int             Add a single block in the todo queue (default -1)
      --from int              Add a series of blocks into the todo queue starting from the provided number (only use in combination with --to) (default -1)
  -h, --help                  help for queue
      --redis.list string     The name of the list to be used for task management (default "todo")
      --redis.server string   Redis server URL (default "localhost:6379")
      --to int                Add a series of blocks into the todo queue ending with the provided number, inclusive (only use in combination with --from) (default -1)

Global Flags:
      --config string          /path/to/config.yml
      --logging string         Display debug messages
      --v --logging=*=debug    Set all logging modules to debug (shorthand for --logging=*=debug)
      --vv --logging=*=trace   Set all logging modules to trace (shorthand for --logging=*=trace)
```

**Example run**

```
cp config-sample.yml config.yml

# queue a single block
./memento queue --block 123

# queue all blocks in the [0, 1000] interval
./memento queue --from 0 --to 1000
```


---

# 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://alethio.gitbook.io/memento/cli-usage/available-commands.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.
