Skip to content

Core Environment Variables

Environment variables configure the runtime of a SmartHoldem Core node. They can be set in the shell, in a .env file at the project root, or through your process manager (pm2 ecosystem, systemd, Docker --env-file).

Precedence

  1. Values from shell environment override
  2. Values from .env file, which override
  3. Defaults hard-coded in the node's defaults.ts (per module).

Never commit secrets

.env files often contain CORE_DB_PASSWORD, forger BIP-39 mnemonics, and TLS keys. Add .env to .gitignore and use a secrets manager (Vault, AWS SM, sops) for production deployments.

Database

VariableDescription
CORE_DB_DATABASEThis variable determines what database will be used for database communication.
CORE_DB_HOSTThis variable determines what host will be used for database communication.
CORE_DB_PASSWORDThis variable determines what password will be used for database communication.
CORE_DB_PORTThis variable determines what port will be used for database communication.
CORE_DB_USERNAMEThis variable determines what username will be used for database communication.

Public API

VariableDescription
CORE_API_CACHEThis variable determines if the API makes use of caching to improve performance.
CORE_API_DISABLEDThis variable determines if the API is enabled.
CORE_API_HOSTThis variable determines the host at which the API will listen for traffic.
CORE_API_NO_ESTIMATED_TOTAL_COUNTThis variable determines if estimated counts should be used. This greatly enhanced performance will yield in inaccurate counts.
CORE_API_PORTThis variable determines the port at which the API will listen for traffic.
CORE_API_SEMAPHORE_DISABLEDThis variable determines if semaphore plugin is disabled.

API — Rate Limiting

VariableDescription
CORE_API_RATE_LIMIT_BLACKLISTThis variable determines which IP addresses are unable to send any requests to the API.
CORE_API_RATE_LIMIT_DISABLEDThis variable determines if rate limiting is disabled.
CORE_API_RATE_LIMIT_USER_EXPIRESThis variable determines how long it takes before the rate limiting expires.
CORE_API_RATE_LIMIT_USER_LIMITThis variable determines how many requests a user can send for any given period.
CORE_API_RATE_LIMIT_WHITELISTThis variable determines which user are exempted from rate limiting.

API — SSL

VariableDescription
CORE_API_SSLThis variable determines if SSL (HTTPS) is enabled.
CORE_API_SSL_CERTThis variable determines where the SSL Certification is located.
CORE_API_SSL_HOSTThis variable determines the host at which the HTTPS API will listen for traffic.
CORE_API_SSL_KEYThis variable determines where the SSL Key is located.
CORE_API_SSL_PORTThis variable determines the host at which the HTTPS API will listen for traffic.

P2P Network

VariableDescription
CORE_P2P_HOSTThis variable determines the host at which the P2P API will be listening for traffic.
CORE_P2P_MAX_PEERS_SAME_SUBNETThis variable determines how many peers from the same subnet are allowed to connect.
CORE_P2P_MAX_PEER_SEQUENTIAL_ERRORSThis variable determines how many errors a peer can cause before it is disconnected.
CORE_P2P_MIN_NETWORK_REACHThis variable determines minimum number of peers that should be connected.
CORE_P2P_PORTThis variable determines the port at which the P2P API will be listening for traffic.
CORE_P2P_RATE_LIMITThis variable determines how many requests per second can be sent by a peer.
CORE_P2P_RATE_LIMIT_POST_TRANSACTIONSThis variable determines how many transaction requests per second can be sent by a peer.

Transaction Pool

VariableDescription
CORE_MAX_TRANSACTIONS_IN_POOLThis variable determines how many transactions can be in the transaction pool at any given time.
CORE_TRANSACTION_POOL_DISABLEDThis variable determines if the transaction pool should be disabled.
CORE_TRANSACTION_POOL_MAX_PER_REQUESTThis variable determines how many transactions can be broadcast in a single request.
CORE_TRANSACTION_POOL_MAX_PER_SENDERThis variable determines how many transactions can be in the transaction pool by a single sender.

Logging

VariableDescription
CORE_LOG_LEVELThis variable determines the severity of messages that are logged.
CORE_LOG_LEVEL_FILEThis variable determines where the log files are stored.

Manager

VariableDescription
CORE_MANAGER_ARCHIVE_FORMATThis variable determines which archive format is used for storing logs.
CORE_MANAGER_DISABLEDThis variable determines if the Manager API is disabled.
CORE_MANAGER_HOSTThis variable determines the host at which the Manager API will be listening for traffic.
CORE_MANAGER_PORTThis variable determines the port at which the Manager API will be listening for traffic.
CORE_MANAGER_PUBLIC_IPThis variable determines the public ip of host.
CORE_MANAGER_SSLThis variable determines if SSL (HTTPS) is enabled for the Manager API.
CORE_MANAGER_SSL_CERTThis variable determines where the SSL Certification is located.
CORE_MANAGER_SSL_HOSTThis variable determines the host at which the HTTPS Manager API will be listening for traffic.
CORE_MANAGER_SSL_KEYThis variable determines where the SSL Key is located.
CORE_MANAGER_SSL_PORTThis variable determines the port at which the HTTPS Manager API will be listening for traffic.

Watcher

VariableDescription
CORE_WATCHER_ENABLEDThis variable determines if monitoring is enabled.

Webhooks

VariableDescription
CORE_WEBHOOKS_ENABLEDThis variable determines if webhooks are enabled.
CORE_WEBHOOKS_HOSTThis variable determines the host at which the Webhook API will be listening for traffic.
CORE_WEBHOOKS_PORTThis variable determines the port at which the Webhook API will be listening for traffic.
CORE_WEBHOOKS_TIMEOUTThis variable determines how long it will take for a request to timeout when trying to transmit a webhook payload.

Other

VariableDescription
CORE_NETWORK_NAME> This variable is exposed by core and cannot be manually configured. This variable exposes the name of the network that has been configured.
CORE_NPM_REGISTRYThis variable determines which NPM registry url should be used.
CORE_PATH_DATA> This variable is exposed by core and cannot be manually configured. This variable exposes the path at which core stores application data.
CORE_RESET_DATABASEThis variable determines if database should be truncated at boot.
CORE_TOKEN> This variable is exposed by core and cannot be manually configured. This variable determines the name of the token.
CORE_WALLET_SYNC_ENABLEDThis variable determines if wallets should be synced to the database.
CORE_WATCH_BLOCKS_DISABLEDThis variable determines if monitoring of blocks is disabled.
CORE_WATCH_ERRORS_DISABLEDThis variable determines if monitoring of errors is disabled.
CORE_WATCH_LOGS_DISABLEDThis variable determines if monitoring of logs is disabled.
CORE_WATCH_QUERIES_DISABLEDThis variable determines if monitoring of queries is disabled.
CORE_WATCH_QUEUES_DISABLEDThis variable determines if monitoring of queues is disabled.
CORE_WATCH_ROUNDS_DISABLEDThis variable determines if monitoring of rounds is disabled.
CORE_WATCH_SCHEDULES_DISABLEDThis variable determines if monitoring of schedules is disabled.
CORE_WATCH_TRANSACTIONS_DISABLEDThis variable determines if monitoring of transactions is disabled.
CORE_WATCH_WALLETS_DISABLEDThis variable determines if monitoring of wallets is disabled.
CORE_WATCH_WEBHOOKS_DISABLEDThis variable determines if monitoring of webhooks is disabled.

Loading .env

bash
# Example .env for a mainnet relay node
CORE_DB_HOST=127.0.0.1
CORE_DB_PORT=5432
CORE_DB_DATABASE=sth_mainnet
CORE_DB_USERNAME=sth
CORE_DB_PASSWORD=change_me

CORE_API_HOST=0.0.0.0
CORE_API_PORT=6100
CORE_API_RATE_LIMIT_DISABLED=false
CORE_API_RATE_LIMIT_USER_LIMIT=300

CORE_P2P_HOST=0.0.0.0
CORE_P2P_PORT=6101
CORE_P2P_MIN_NETWORK_REACH=5

CORE_LOG_LEVEL=info

Start the node with:

bash
sth-core relay:start --env=.env
# or via pm2
pm2 start sth-core -- relay:start

See Also

Code is the Law. Zero Infrastructure. Absolute Autonomy.