-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
logFileName
property:{ "logFileName": "path/to/your/log/file.txt" }
You can use
.log
,.txt
or 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:
trace
debug
log
info
warn
error
fatal
none
-
Port
Specify the server's API port with the
port
property:{ "port": 36666 }
-
Address
Define the server's listening address using the
address
property:{ "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
trustProxy
property:{ "trustProxy": false }
-
Database Connection
Configure database connection settings with the
db
object:{ "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
redis
object:{ "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
).
-
-
API Settings
Control Public API behavior with the
api
object:{ "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.public
isfalse
(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
peers
object:{ "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
broadcasts
object:{ "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
transactions
object:{ "transactions": { "maxTxsPerQueue": 1000 } }
-
maxTxsPerQueue
: Max transactions per queue (recommended:1000
).
-
-
Forging Settings
Configure forging behavior with the
forging
object:{ "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
loading
object:{ "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
ssl
object:{ "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
dapp
object:{ "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
wsClient
object:{ "wsClient": { "enabled": true, "portWS": 36668 } }
-
enabled
: Enable or disable WebSocket client (e.g.,true
). -
portWS
: WebSocket client port (e.g.,36668
).
-
-
Nethash
The
nethash
property 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 betweenmainnet
andtestnet
).Example configuration for mainnet:
{ "nethash": "bd330166898377fb28743ceef5e43a5d9d0a3efd9b3451fb7bc53530bb0a6d64" }
Example configuration for testnet:
{ "nethash": "38f153a81332dea86751451fd992df26a9249f0834f72f58f84ac31cceb70f43" }
You can find or generate a
nethash
using the genesis block (genesisBlock.json
ortest/genesisBlock.json
based on your blockchain network).