sample.env


Overview

The `sample.env` file serves as a template for environment configuration variables required by the application. It defines both secret keys and public environment settings that the application depends on to connect to external services, configure logging, and specify network details.

This file is **not** meant to be used directly in production; rather, it provides a structured example for developers to create their own `.env` file with actual secret values and environment-specific configurations. Typically, this file is kept out of version control (e.g., via `.gitignore`) to avoid leaking sensitive credentials.


Detailed Explanation of Contents

The file is divided into two sections:

1. Secret Environment Variables

These variables store sensitive API keys used to authenticate requests with third-party services:

Variable Name

Description

Example Value

`ETHERSCAN_API_KEY`

API key used to access the Etherscan blockchain explorer API for querying Ethereum network data.

(empty, to be filled)

`INDEXER_API_KEY`

API key for the blockchain indexer service, enabling access to indexed blockchain data for efficient querying.

(empty, to be filled)

`RPC_API_KEY`

API key used for RPC (Remote Procedure Call) endpoints, typically for blockchain node access.

(empty, to be filled)

**Note:** These keys must be kept confidential and never committed to public repositories.


2. Environment Variables

These variables configure the operational environment and endpoints:

Variable Name

Description

Example Value

`INDEXER_URL`

HTTP endpoint URL for the blockchain indexer API.

https://bsc-blockbook.nownodes.io

`INDEXER_WS_URL`

WebSocket URL for real-time blockchain indexer updates.

wss://bsc-blockbook.nownodes.io/wss

`LOG_LEVEL`

Logging verbosity level for the application (e.g., debug, info, warn, error).

`debug`

`NETWORK`

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

mainnet

`RPC_URL`

HTTP RPC endpoint URL to interact with the blockchain node (e.g., for sending transactions).

`https://bsc.nownodes.io`


Usage Example

Developers typically use this file as a starting point to create a `.env` file by copying it and filling in the secret keys:

cp sample.env .env
# Edit .env to add API keys and adjust environment variables

The application will then load the `.env` file using environment variable loaders (e.g., `dotenv` in Node.js or similar tools), making these variables accessible via process environment variables.


Implementation Details and Considerations


Interaction with Other Parts of the System


Visual Diagram: Environment Variables Flowchart

flowchart TD
    A[Start: Application Initialization] --> B[Load .env File]
    B --> C{Parse Environment Variables}
    C --> |Secret Keys| D[Set ETHERSCAN_API_KEY, INDEXER_API_KEY, RPC_API_KEY]
    C --> |Public Configs| E[Set INDEXER_URL, INDEXER_WS_URL, LOG_LEVEL, NETWORK, RPC_URL]
    D --> F[API Clients Use Secret Keys]
    E --> G[Configure Network and Logging]
    G --> H[Initialize Blockchain RPC and Indexer Connections]
    H --> I[Application Ready]

Summary


*End of `sample.env` documentation.*