sample.env


Overview

The `sample.env` file serves as a template for environment variable configuration in the application. It defines key-value pairs that specify critical runtime parameters such as API keys, network URLs, logging levels, and endpoints. These variables are essential for configuring the application's interaction with external services (such as blockchain indexers and RPC nodes), controlling logging verbosity, and selecting the operational network environment.

This file is typically used as a reference or starting point to create a `.env` file that the application reads during startup to load environment-specific settings securely and consistently.


Detailed Explanation

File Type and Purpose

Variables Defined

Variable

Description

Example Value

Notes

`ETHERSCAN_API_KEY`

API key for accessing Etherscan services (blockchain explorer and analytics).

*(empty in sample, to be filled by user)*

Kept secret; used for blockchain queries or analytics.

`INDEXER_URL`

HTTP endpoint URL for the blockchain indexer service (used to query blockchain state).

https://dev-indexer.arbitrum-nova.shapeshift.com

Points to a development indexer instance.

`INDEXER_WS_URL`

WebSocket URL for real-time communication with the blockchain indexer.

wss://dev-indexer.arbitrum-nova.shapeshift.com/websocket

Enables subscription or push notifications.

`LOG_LEVEL`

Sets the verbosity level of application logs.

`debug`

Common levels: debug, info, warn, error.

`NETWORK`

Specifies the blockchain network environment the application targets.

`mainnet`

Could also be `testnet`, `devnet`, etc.

`RPC_URL`

Remote Procedure Call URL for interacting with the blockchain node or daemon.

https://dev-daemon.arbitrum-nova.shapeshift.com

Used for submitting transactions or querying chain state.


Usage

How to Use sample.env

  1. Copy the file: Typically, you copy sample.env to .env in the root of your project.

    cp sample.env .env
    
  2. Edit .env: Populate the empty or placeholder values with valid credentials and URLs specific to your environment.

  3. Load environment variables: The application or its configuration loader reads .env to set environment variables for runtime.

  4. Run the application: The app uses these variables to configure services such as logging, blockchain network connections, and API integrations.

Example

# Copy the sample env file
cp sample.env .env

# Edit the .env file to insert your Etherscan API key
# For example, open in an editor and modify:
# ETHERSCAN_API_KEY=your_real_api_key_here

# Run the application (assuming a Node.js app using dotenv)
node app.js

Implementation Details


Interaction with Other System Components


Mermaid Diagram: Environment Variable Relationships and Usage Flow

flowchart TD
    subgraph ENV_FILE
        SAMPLE_ENV[sample.env<br/>(KEY=VALUE pairs)]
        DOT_ENV[.env<br/>(User customized)]
    end

    subgraph APP[Application]
        CONFIG[Config Loader<br/>(reads .env)]
        LOGGING[Logging Module<br/>(uses LOG_LEVEL)]
        INDEXER_CLIENT[Indexer Client<br/>(uses INDEXER_URL, INDEXER_WS_URL)]
        RPC_CLIENT[RPC Client<br/>(uses RPC_URL)]
        NETWORK_LOGIC[Network Logic<br/>(uses NETWORK)]
        API_KEYS[API Keys<br/>(ETHERSCAN_API_KEY)]
    end

    SAMPLE_ENV -->|Copy & Edit| DOT_ENV
    DOT_ENV --> CONFIG
    CONFIG --> LOGGING
    CONFIG --> INDEXER_CLIENT
    CONFIG --> RPC_CLIENT
    CONFIG --> NETWORK_LOGIC
    CONFIG --> API_KEYS

Summary


*End of Documentation for `sample.env`*