// Sample config file parsed in config/config.go
// conf_template.json
{
"staychain": {
"initTx": "87e56bda501ba6a022f12e178e9f1ac03fb2c07f04e1dfa62ac9e1d83cd840e1",
"initChaincode": "0a090f710e47968aee906804f211cf10cde9a11e14908ca0f78cc55dd190ceaa",
"topupAddress": "2MxBi6eodnuoVCw8McGrf1nuoVhastqoBXB",
"regtest": "1"
},
"main": {
"rpcurl": "127.0.0.1:18000",
"rpcuser": "USERNAME",
"rpcpass": "PASSWORD",
"chain": "regtest"
},
"clientchain": {
"rpcurl": "127.0.0.1:19000",
"rpcuser": "USERNAME",
"rpcpass": "PASSWORD",
"chain": "main"
},
"signer": {
"publisher": "*:5000",
"signers": "node0:1000,node1:1001"
},
"db": {
"user":"user",
"password":"pssword",
"host":"localhost",
"port":"27017",
"name":"mainstay"
},
"fees": {
"minFee": "5",
"maxFee": "50",
"feeIncrement": "2"
},
"timing": {
"newAttestationMinutes": "60",
"handleUnconfirmedMinutes": "60"
}
}
Currently main
config category is compulsory. This should be made optional in the future as tools that do not require main
rpc connectivity options use this.
main
: configuration options for connection to bitcoin noderpcurl
: address for rpc connectivityrpcuser
: user name for rpc connectivityrpcpass
: password for rpc connectivitychain
: chain name for inner config, i.e. testnet/regtest/mainnet
The staychain
category is compulsory and can be set from either .conf file or command line arguments. The configuration below is optional as preferred entry is via command line - options.
staychain
: configuration options for staychain parametersinitTx
: initial transaction sets the state for the staychaininitChaincode
: chaincode of init script pubkeys used to derive staychain addresstopupAddress
: address to topup the mainstay service
Several other subcategories become compulsory only if the base category exists in the .conf
file.
For the base categories db
and signer
the following parameters are compulsory:
-
db
: configuration options for databaseuser
: db user namepassword
: db user passwordhost
: db host addressport
: db host portname
: db name
-
signer
: zmq signer connectivity optionssigners
: list of comma separated addresses (host:port) for connectivity to signers
All the remaining conf options are optional. These are explained below:
signer
publisher
: optionally provide host address for main service zmq publisher
Default values are set in attestation/attestsigner_zmq.go
.
fees
: fee configuration parameters for attestation serviceminFee
: minimum fee for attestation transactionsmaxFee
: maximum fee for attestation transactionsfeeIncrement
: fee increment value used when bumping fees
Default values are set in attestation/attestfees.go
timing
: various timing configuration parameters used by attestation servicenewAttestationMinutes
: option in minutes to set frequency of new attestationshandleUnconfirmedMinutes
: option in minutes to set duration of waiting for an unconfirmed transaction before bumping fees
Default values are set in attestation/attestservice.go
Currently only parameters in the staychain
category can be parsed through command line arguments.
These command line arguments are:
tx
: argument for initTx as abovechaincode
: argument for initChaincode as aboveaddrTopup
: argument for topupAddress as above
All config parameters can be replaced with env variables. An example of this is config/conf.json
.
The Config struct works by first looking for an env variable with the name set and if an env variable is not found then the config parameter is set to the actual value provided.
If the config argument is not to be used, no value should be set in the conf file. Warnings for invalid argument values are provided in runtime.
Parameters used for client chain confirmation tools and are not part of Config struct used by service.
clientchain
: configuration options for connectivity to client rpc node
Same configuration options as main
. The clientchain
name can be replaced with any name to match the sidechain. See cmd/confirmationtool/conf.json
. This is not used by Config struct, only by config::NewClientFromConfig()
.