Environment Variables

Complete reference of all environment variables across NCN Network v2 components.


Gateway Node

Required

Variable
Description
Example

GATEWAY_WALLET_PRIVATE_KEY

Gateway wallet private key

0xabcd...

RPC_URL

Blockchain RPC endpoint

http://127.0.0.1:8545

CONTRACT_ADDRESS

InferencePayment contract address

0x4361...

REGISTRY_GRPC_ADDR

P2P Registry gRPC address

http://127.0.0.1:50050

Optional

Variable
Default
Description

GATEWAY_WALLET_ADDRESS

Derived

Wallet address (derived from key)

GRPC_ADDR

127.0.0.1:50051

gRPC listen address

HTTP_ADDR

127.0.0.1:8080

HTTP listen address

WS_ADDR

127.0.0.1:9000

WebSocket listen address

SUBNET_ID

1

Gateway's subnet ID

NETWORK

forknet

Network name

GAS_LIMIT

500000

Default gas limit

GAS_PRICE_MULTIPLIER

1.1

Gas price multiplier

REQUIRED_CONFIRMATIONS

1

Required tx confirmations

CONFIRMATION_TIMEOUT_SECS

300

Confirmation timeout

ENABLE_PAYMENT_VERIFICATION

true

Enable payment verification

REQUIRE_PAYMENT

false

Require payment for requests


Compute Node

Required

Variable
Description
Example

GATEWAY_ADDR

Gateway address (or CLI arg)

http://127.0.0.1:50051

Optional

Variable
Default
Description

COMPUTE_NODE_PRIVATE_KEY

Auto-generated

Node wallet private key

NODE_WALLET_ADDRESS

Derived

Node wallet address

MODEL_PATH

./models

Model files directory

SANDBOX_MODE

strict

Sandbox mode: strict, permissive, disabled

EXECUTION_TIMEOUT_SECS

300

Max execution time (seconds)

MAX_MEMORY_MB

4096

Max memory per execution (MB)

MAX_CPU_CORES

All

Max CPU cores per execution

ENABLE_EXECUTION_FALLBACK

false

Enable fallback execution

REQUIRE_PAYMENT

false

Require payment validation

PYTHON_EXECUTOR_PATH

python_executors

Path to Python executors

PYTHON_PATH

python3

Python interpreter path

PYTHON_VENV_PATH

None

Python virtual environment

Sandbox-specific

Variable
Default
Description

SANDBOX_ALLOW_NETWORK

false

Allow network in sandbox

SANDBOX_ALLOWED_PATHS

/tmp

Additional allowed paths

SANDBOX_MAX_PROCESSES

10

Max processes in sandbox

SANDBOX_MAX_FDS

1024

Max file descriptors


P2P Registry Node

Required

Variable
Description
Example

None

All have defaults

-

Optional

Variable
Default
Description

P2P_LISTEN_ADDR

/ip4/0.0.0.0/tcp/8828

P2P listen address

GRPC_LISTEN_ADDR

127.0.0.1:50050

gRPC listen address

VALIDATOR_PRIVATE_KEY

Auto-generated

Validator signing key

VALIDATOR_SYNC_ENABLED

true

Enable blockchain sync

VALIDATOR_SYNC_INTERVAL

60

Sync interval (seconds)

VALIDATOR_SYNC_ACTIVE_ONLY

false

Sync only active validators

VALIDATOR_REGISTRY_CONTRACT

None

On-chain validator registry

FORKNET_RPC_URL

None

Blockchain RPC URL

CHAIN_ID

828

Blockchain chain ID

MIN_VALIDATORS_FOR_CONSENSUS

3

Minimum validators for M-of-N

MAX_VALIDATORS_TO_SELECT

5

Maximum validators to select

MIN_REPUTATION_THRESHOLD

20

Minimum validator reputation


Test Client

Required

Variable
Description
Example

None

All configurable via CLI

-

Optional

Variable
Default
Description

GATEWAY_ADDR

http://127.0.0.1:50051

Gateway gRPC address

CLIENT_PRIVATE_KEY

None

Client wallet private key

NETWORK

local

Network name


Smart Contracts (Foundry)

Deployment

Variable
Description
Example

PRIVATE_KEY

Deployer private key

0xabcd...

RPC_URL

RPC endpoint

http://127.0.0.1:8545

ETHERSCAN_API_KEY

For verification

ABC123...


Logging

All Components

Variable
Default
Description

RUST_LOG

info

Log level filter

RUST_BACKTRACE

0

Enable backtraces (1 for basic, full for detailed)

Log Level Examples


Docker Environment

Docker Compose Variables

Create .env file in project root:


Security Notes

Sensitive Variables

NEVER commit these to version control:

  • *_PRIVATE_KEY

  • *_SECRET

  • API keys

Best Practices


Quick Setup Templates

Development

Testing

Production


Variable Priority

Configuration priority (highest to lowest):

  1. Command line arguments

  2. Environment variables

  3. .env file

  4. Default values

Last updated