Configurations

Hemera indexer can read configuration from cmd line arguments or environment variables.

  • If you run Hemera Indexer in Docker, then the environment variable is easier to configure.

  • If you prefer running from Source Code, command line arguments are more intuitive.

Run with python hemera.py stream --help to get the latest instructions for arguments.

Parameters

  • If the name of the parameter is in UPPER_CASE then it's an environment variable.

  • If the name of the parameter starts with -- then it's a command line argument.

Avoid specifying the same parameter from both the environment variable and the command line argument.

PROVIDER_URI or --provider-uri

[Default: https://mainnet.infura.io]

The URI of the web3 rpc provider, e.g. file://$HOME/Library/Ethereum/geth.ipc or https://mainnet.infura.io.

DEBUG_PROVIDER_URI or --debug-provider-uri

[Default: https://mainnet.infura.io]

The URI of the web3 debug rpc provider, e.g. file://$HOME/Library/Ethereum/geth.ipc or https://mainnet.infura.io.

POSTGRES_URL or --postgres-url

[Required] The PostgreSQL connection URL that the Hemera Indexer used to maintain its state. e.g. postgresql+psycopg2://user:password@127.0.0.1:5432/postgres.

OUTPUT or --output or -o

[Required] You may specify the output parameter so Hemera Indexer will export the data to CSV or JSON files. If not specified the data will be printed to the console.

If you have multiple outputs, use "," to concat the files. The file location will be relative to your current location if you run from source code, or the output folder as configured in docker-compose.yaml.

e.g.

  • postgresql+psycopg2://user:password@localhost:5432/hemera_indexer: Output will be exported to your postgres.

  • jsonfile://output/json: Json files will be exported to folder output/json

  • csvfile://output/csv: Csv files will be exported to folder output/csv

  • console,jsonfile://output/json,csvfile://output/csv: Multiple destinations are supported.

ENTITY_TYPES or --entity-types or -E

[Default: EXPLORER_BASE,EXPLORER_TOKEN] The list of entity types to export. e.g. EXPLORER_BASE, EXPLORER_TOKEN, EXPLORER_TRACE.

OUTPUT_TYPES or --output-types or -O

The list of output types to export, corresponding to more detailed data models. Specifying this option will prioritize these settings over the entity types specified in -E. Available options include: block, transaction, log, token, address_token_balance, erc20_token_transfer, erc721_token_transfer, erc1155_token_transfer, trace, contract, coin_balance.

You may spawn up multiple Hemera Indexer processes, each of them specifying different output types to accelerate the indexing process. For example, indexing trace data may take much longer than other entities, you may want to run a separate process to index trace data. Checkout docker-compose/docker-compose.yaml for examples.

DB_VERSION or --db-version

[Default: head] The database version to initialize the database. Using the Alembic script's revision ID to specify a version. e.g. head, indicates the latest version. Or base, indicates the empty database without any table. Default value: head

START_BLOCK or --start-block

The block number to start from, e.g. 0, 1000, etc. If you don't specify this, Hemera Indexer will read the last synced block from the PostgreSQL database and resume from it.

END_BLOCK or --end-block

The block number that ends at, e.g. 10000, 20000, etc.

PARTITION_SIZE or --partition-size

[Default: 50000] The number of records to write to each file.

PERIOD_SECONDS or --period-seconds

[Default: 10] Seconds to sleep between each sync with the latest blockchain state.

BATCH_SIZE or --batch-size

[Default: 10] The number of non-debug rpc requests to batch in a single request.

DEBUG_BATCH_SIZE or --debug-batch-size

[Default: 1] The number of debug rpc to batch in a single request.

BLOCK_BATCH_SIZE or --block-batch-size

[Default: 1] The number of blocks to batch in a single sync round.

MAX_WORKERS or --max-workers

[Default: 5] The number of workers, e.g. 4, 5, etc.

LOG_FILE or --log-file

The log file to use. e.g. path/to/logfile.log.

Last updated