-
-
Notifications
You must be signed in to change notification settings - Fork 110
Configuration
The configuration file should be named config.json if the app starts with the command:
npm run start
or test/config.json when starting the testnet with:
npm run start:testnet
You can also provide a custom path to your configuration file using the --config option:
node app.js --config path/to/your/config.json
You can copy the configuration file from the default templates:
config.default.json for config.json or test/config.default.json for test/config.json. For example:
cp config.default.json config.json
-
Log file path
Specify path to the log file using
logFileNameproperty:{ "logFileName": "path/to/your/log/file.txt" }You can use
.log,.txtor any other extension. -
Logging Level
The logging level can differ between the file and the console for debugging purposes:
{ "fileLogLevel": "warn", "consoleLogLevel": "debug" }Possible log levels:
tracedebugloginfowarnerrorfatalnone
-
Port
Specify the server's API port with the
portproperty:{ "port": 36666 } -
Address
Define the server's listening address using the
addressproperty:{ "address": "0.0.0.0" }Example:
0.0.0.0(binds to all network interfaces). -
Trust Proxy
Enable or disable trusting proxy headers using the
trustProxyproperty:{ "trustProxy": false }
-
Database Connection
Configure database connection settings with the
dbobject:{ "db": { "host": "localhost", "port": 5432, "database": "adamant_main", "user": "adamant", "password": "password", "poolSize": 95, "poolIdleTimeout": 30000, "reapIntervalMillis": 1000, "logEvents": ["error"] } }-
host: Database host (e.g.,localhost). -
port: Database port (e.g.,5432). -
database: Name of the database (e.g.,adamant_main). -
user: Database username (e.g.,adamant). -
password: Database password. -
poolSize: Number of connections in the pool (recommended:95). -
poolIdleTimeout: Time (ms) before idle connections close (recommended:30000). -
reapIntervalMillis: Interval (ms) to clean idle connections (recommended:1000). -
logEvents: List of events to log (e.g.,["error"]).
-
Redis is used for caching. Required.
-
Redis Connection
Configure Redis connection settings with the
redisobject:{ "redis": { "url": "redis://127.0.0.1:6379/0", "password": null } }-
url: Redis server URL (e.g.,redis://127.0.0.1:6379/0). -
password: Redis password (string ornull).
-
Note
Even when a node's Public API is disabled (including api.enabled = false, api.access.public = false), other nodes can still connect to it for block exchange—such nodes still participate in blockchain synchronization.
Warning
Nodes with a Public API, used by applications, require more CPU since they execute many SQL queries.
-
API Settings
Control Public API behavior with the
apiobject:{ "api": { "enabled": true, "access": { "public": false, "whiteList": ["127.0.0.1"] }, "options": { "limits": { "max": 0, "delayMs": 0, "delayAfter": 0, "windowMs": 60000 } } } }-
enabled: Enable or disable the Public API (e.g.,true). -
access.public: Allow public API access for any IP address (recommended:false). -
access.whiteList: List of allowed IP addresses ifaccess.publicisfalse(e.g.,["127.0.0.1"]). -
options.limits: API rate-limiting options:-
max: Max requests per window (e.g.,0, unlimited). -
delayMs: Delay (ms) before responding to requests (e.g.,0). -
delayAfter: Start delaying after N requests (e.g.,0). -
windowMs: Time window for rate limits (e.g.,60000).
-
-
-
Peer Settings
Configure peer connections with the
peersobject:{ "peers": { "enabled": true, "list": [ { "ip": "5.161.68.61", "port": 36666 }, { "ip": "149.102.157.15", "port": 36666 } ], "access": { "blackList": [] }, "options": { "limits": { "max": 0, "delayMs": 0, "delayAfter": 0, "windowMs": 60000 }, "timeout": 5000 } } }-
enabled: Enable or disable peer connections (default:true). -
list: List of peer IPs and ports. -
access.blackList: List of blocked IPs (e.g.,["222.222.222.222"]). -
options.limits: Peer rate-limiting options:-
max: Max requests per window (e.g.,0, unlimited). -
delayMs: Delay (ms) before responding (e.g.,0). -
delayAfter: Start delaying after N requests (e.g.,0). -
windowMs: Time window for rate limits (e.g.,60000).
-
-
options.timeout: Peer connection timeout (ms, default:5000).
-
-
Broadcast Settings
Control broadcast behavior with the
broadcastsobject:{ "broadcasts": { "broadcastInterval": 1500, "broadcastLimit": 20, "parallelLimit": 20, "releaseLimit": 25, "relayLimit": 4 } }-
broadcastInterval: Time (ms) between broadcasts (recommended:1500). -
broadcastLimit: Max broadcasts per interval (recommended:20). -
parallelLimit: Max parallel broadcasts (recommended:20). -
releaseLimit: Max broadcasts released (recommended:25). -
relayLimit: Max relayed broadcasts (recommended:4).
-
-
Transaction Queue
Control transaction queue size with the
transactionsobject:{ "transactions": { "maxTxsPerQueue": 1000 } }-
maxTxsPerQueue: Max transactions per queue (recommended:1000).
-
-
Forging Settings
Configure forging behavior with the
forgingobject:{ "forging": { "force": false, "secret": [], "access": { "whiteList": ["127.0.0.1"] } } }-
force: Force forging regardless of network state (default:false). -
secret: List of forging pass phrases. -
access.whiteList: Allowed forging IPs (e.g.,["127.0.0.1"]).
-
-
Loading Settings
Control loading behavior with the
loadingobject:{ "loading": { "verifyOnLoading": false, "loadPerIteration": 5000 } }-
verifyOnLoading: Verify data during loading (e.g.,false). -
loadPerIteration: Max items to load per iteration (recommended:5000).
-
-
SSL Settings
Configure SSL options with the
sslobject:{ "ssl": { "enabled": false, "options": { "port": 443, "address": "0.0.0.0", "key": "./ssl/adamant.key", "cert": "./ssl/adamant.crt" } } }-
enabled: Enable or disable SSL (e.g.,false). -
options.port: SSL port (e.g.,443). -
options.address: Listening address for SSL (e.g.,0.0.0.0). -
options.key: Path to SSL key file. -
options.cert: Path to SSL certificate file.
-
-
DApp Settings
Control DApp settings with the
dappobject:{ "dapp": { "masterrequired": true, "masterpassword": "", "autoexec": [] } }-
masterrequired: Require master password for DApp execution (recommended:true). -
masterpassword: Master password (e.g.,"<empty>"). -
autoexec: List of auto-executable scripts (e.g.,[]).
-
-
WebSocket Client
Configure WebSocket client settings with the
wsClientobject:{ "wsClient": { "enabled": true, "portWS": 36668 } }-
enabled: Enable or disable WebSocket client (e.g.,true). -
portWS: WebSocket client port (e.g.,36668).
-
-
Nethash
The
nethashproperty represents the unique identifier for the blockchain network. It ensures the application connects to the correct network and prevents accidental cross-network operations (e.g., mixing transactions betweenmainnetandtestnet).Example configuration for mainnet:
{ "nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64" }Example configuration for testnet:
{ "nethash": "38f153a81332dea86751451fd992df26a9249f0834f72f58f84ac31cceb70f43" }You can find or generate a
nethashusing the genesis block (genesisBlock.jsonortest/genesisBlock.jsonbased on your blockchain network).