Config files

There are many flags and commands that can be provided to Etn-sc on startup to influence how your node will behave. It is often convenient to configure these options in a file rather than typing them out on the command line every time you start your node. This can be done using a simple shell script to start Etn-sc.

There are also other configuration options that are not accessible from the command line but can be adjusted by providing Etn-sc with a config file. This gives access to lower level configuration that influences how some of Etn-sc's internal components behave.

Shell scripts

The benefit of writing a shell script for starting a Etn-sc node is that it is more easily repeatable and you don't have to remember lots of syntax for making a node behave in a certain way. This is especially useful for running multiple nodes with their own specific configurations.

To create a shell script, save the Etn-sc startup commands in a shell file, prepended with #!/bin/bash. The contents of the file might look like this:

#! /bin/bash
./etn-sc --testnet --datadir testnet --http --http.api eth,net --metrics.expensive --metric.addr 127.0.0.1 --metrics.port 6060

Save the file as (e.g.) start-etn-sc.sh. Then make the file executable using

chmod +x start-etn-sc.sh

Now you can start Etn-sc using this shell script instead of having to create the startup configuration from scratch each time:

./start-etn-sc.sh

Config files

It is also possible to tweak the deeper configuration via a config file. The config file is more complex than a shell script but it can touch parts of the internal configuration structure of Etn-sc that are not accessible through the command line interface.

The config file should be a .toml file. A convenient way to create a config file is to get Etn-sc to create one for you and use it as a template. To do this, use the dumpconfig command, saving the result to a .toml file. Note that you also need to explicitly provide the network_id on the command line for the public testnet:

./etn-sc --testnet dumpconfig > etn-sc-config.toml

You can change the values in this file and then pass it to Etn-sc on startup so that the node is configured exactly as you want it. To override an option specified in the configuration file, specify the same option on the command line.

To run Etn-sc with the configuration defined in etn-sc-config.toml, pass the config file path to --config. The network_id is not persisted from the config file; it has to be explicitly defined on the command line on startup, for example:

./etn-sc --testnet --config etn-sc-config.toml

Config file example

The config file created using dumpconfig contains the following information (this example is for the testnet - Mainnet and other network configurations will be slightly different):

[Eth]
NetworkId = 5201420
SyncMode = "snap"
EthDiscoveryURLs = []
SnapDiscoveryURLs = []
NoPruning = false
NoPrefetch = false
TxLookupLimit = 6307200
LightPeers = 100
UltraLightFraction = 75
DatabaseCache = 512
DatabaseFreezer = ""
TrieCleanCache = 154
TrieCleanCacheJournal = "triecache"
TrieCleanCacheRejournal = 3600000000000
TrieDirtyCache = 256
TrieTimeout = 3600000000000
SnapshotCache = 102
Preimages = false
EnablePreimageRecording = false
RPCGasCap = 50000000
RPCEVMTimeout = 5000000000
RPCTxFeeCap = 1e+05

[Eth.Miner]
GasFloor = 0
GasCeil = 30000000
GasPrice = 1000000000
Recommit = 3000000000
Noverify = false

[Eth.Ethash]
CacheDir = "ethash"
CachesInMem = 2
CachesOnDisk = 3
CachesLockMmap = false
DatasetDir = "/Users/andrepatta/Library/Ethash"
DatasetsInMem = 1
DatasetsOnDisk = 2
DatasetsLockMmap = false
PowMode = 0
NotifyFull = false

[Eth.TxPool]
Locals = []
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 5120
AccountQueue = 64
GlobalQueue = 1024
Lifetime = 10800000000000

[Eth.GPO]
Blocks = 20
Percentile = 60
MaxHeaderHistory = 1024
MaxBlockHistory = 1024
MaxPrice = 500000000000
IgnorePrice = 2

[Eth.Istanbul]
RequestTimeout = 10000
BlockPeriod = 5
ProposerPolicy = "id = 0\n"
Epoch = 30000
AllowedFutureBlockTime = 5

[Node]
DataDir = "/Users/andrepatta/Library/Electroneum-sc/testnet"
IPCPath = "etn-sc.ipc"
HTTPHost = ""
HTTPPort = 8545
HTTPVirtualHosts = ["localhost"]
HTTPModules = ["net", "web3", "eth"]
AuthAddr = "localhost"
AuthPort = 8551
AuthVirtualHosts = ["localhost"]
WSHost = ""
WSPort = 8546
WSModules = ["net", "web3", "eth"]
GraphQLVirtualHosts = ["localhost"]

[Node.P2P]
MaxPeers = 50
NoDiscovery = false
BootstrapNodes = ["enode://973089afc9ae8141a47b211cb48979bb1fd2cbf5f24c498b4aab93a7cee5fcb996c7badac0d3b8414608b113bb12b9b997ac5bea35dd7842149a3182e42dfe18@46.137.237.72:30303"]
StaticNodes = []
TrustedNodes = []
ListenAddr = ":30303"
EnableMsgEvents = false

[Node.HTTPTimeouts]
ReadTimeout = 30000000000
WriteTimeout = 30000000000
IdleTimeout = 120000000000

[Metrics]
HTTP = "127.0.0.1"
Port = 6060
InfluxDBEndpoint = "http://localhost:8086"
InfluxDBDatabase = "etn-sc"
InfluxDBUsername = "test"
InfluxDBPassword = "test"
InfluxDBTags = "host=localhost"
InfluxDBToken = "test"
InfluxDBBucket = "etn-sc"
InfluxDBOrganization = "etn-sc"

Last updated