sample.env


Overview

`sample.env` is a configuration template file used to define environment variables for the application. It primarily serves as a reference for developers and deployment scripts, indicating which environment variables need to be set and their expected usage. This file includes both secret keys (which should be securely stored and never committed with actual values) and general environment settings that configure the behavior of the system.

The environment variables in `sample.env` enable the application to connect to external services such as blockchain APIs, logging systems, and indexers without hardcoding sensitive or environment-specific information in the source code. This mechanism supports flexibility, security, and portability across different deployment environments (e.g., development, staging, production).


Environment Variables Explained

The file separates variables into two categories: **Secret Environment Variables** and **General Environment Variables**.

Secret Environment Variables

These variables hold sensitive credentials required to authenticate with external APIs. They should be set securely in the deployment environment and **never committed with actual values**.

Variable Name

Description

Example Value

`ETHERSCAN_API_KEY`

API key for accessing the Etherscan service, which provides blockchain data and analytics.

abcd1234yourapikey

`INDEXER_API_KEY`

API key used to authenticate requests to the indexer service that aggregates blockchain data.

xyz0987indexerapikey

`RPC_API_KEY`

API key for connecting to remote procedure call (RPC) endpoints on the blockchain network.

rpcapikeyvalue

General Environment Variables

These variables configure the runtime behavior of the application, including network endpoints, logging, and blockchain network selection.

Variable Name

Description

Example Value

`INDEXER_URL`

HTTP endpoint URL for the indexer service to fetch blockchain or application data.

`https://gateway.liquify.com`

`INDEXER_WS_URL`

WebSocket URL for the indexer service, enabling real-time communication.

`wss://gateway.liquify.com`

`LOG_LEVEL`

Sets the verbosity of application logging. Common values: `debug`, `info`, `warn`, `error`.

`debug`

NETWORK

Specifies the blockchain network to connect to (e.g., `mainnet`, `testnet`).

`mainnet`

`RPC_URL`

HTTP endpoint URL for the blockchain RPC service to send commands and queries.

`https://gateway.liquify.com`


Usage and Best Practices


Interaction with the Application


Implementation Details


Visual Diagram

Below is a **flowchart** illustrating the role of the environment variables in configuring connections between the main application and the external services it integrates with:

flowchart TD
    A[Application] -->|Reads from sample.env| B[Environment Variables]

    B --> C[Blockchain Network]
    B --> D[Indexer Service]
    B --> E[Etherscan API]
    B --> F[Logging System]

    C -->|RPC_URL & RPC_API_KEY| G[RPC Endpoint]
    D -->|INDEXER_URL & INDEXER_API_KEY| H[Indexer HTTP API]
    D -->|INDEXER_WS_URL| I[Indexer WebSocket API]
    E -->|ETHERSCAN_API_KEY| J[Etherscan API Endpoint]
    F -->|LOG_LEVEL| K[Logger Configuration]

    style B fill:#f9f,stroke:#333,stroke-width:2px

Summary

`sample.env` is a critical configuration template that defines the interface between the application and its execution environment. It ensures sensitive credentials and environment-specific settings are managed securely and flexibly, thereby enabling smooth integration with blockchain networks, indexers, and logging systems. This file is foundational for deployment, environment management, and secure operation of the overall system.