Server Configuration
Default server config
{
"heartbeatInterval": 5,
"baseDir": ".",
"transactionExpireTime": 5,
"crypto": {
"hashKey": "69fa4195670576c0160d660c3be36556ff8d504725be8a59b5a96509e0c994bc"
},
"p2p": {
"ipServer": "api.ipify.org/?format=json",
"timeServers": [
"0.pool.ntp.org",
"1.pool.ntp.org",
"2.pool.ntp.org",
"3.pool.ntp.org"
],
"existingArchivers": [
{
"ip": "127.0.0.1",
"port": 4000,
"publicKey": "758b1c119412298802cd28dbfa394cdfeecc4074492d60844cc192d632d84de3"
}
],
"syncLimit": 180,
"cycleDuration": 30,
"maxRejoinTime": 20,
"difficulty": 2,
"queryDelay": 1,
"gossipRecipients": 4,
"gossipTimeout": 180,
"maxSeedNodes": 10,
"minNodesToAllowTxs": 3,
"minNodes": 15,
"maxNodes": 30,
"seedNodeOffset": 4,
"nodeExpiryAge": 30,
"maxJoinedPerCycle": 1,
"maxSyncingPerCycle": 5,
"maxRotatedPerCycle": 1,
"maxPercentOfDelta": 40,
"scaleReqsNeeded": 5,
"maxScaleReqs": 10,
"amountToScale": 1
},
"ip": {
"externalIp": "127.0.0.1",
"externalPort": 9001,
"internalIp": "127.0.0.1",
"internalPort": 9005
},
"network": {
"timeout": 10
},
"reporting": {
"report": true,
"recipient": "http://127.0.0.1:3000/api",
"interval": 2,
"console": false
},
"debug": {
"loseReceiptChance": 0.0,
"loseTxChance": 0.0,
"canDataRepair": true
},
"statistics": {
"save": true,
"interval": 1
},
"loadDetection": {
"queueLimit": 1000,
"desiredTxTime": 15,
"highThreshold": 0.5,
"lowThreshold": 0.2
},
"rateLimiting": {
"limitRate": true,
"loadLimit": 0.5
},
"stateManager": {
"stateTableBucketSize": 200,
"accountBucketSize": 50
},
"sharding": {
"nodesPerConsensusGroup": 5
}
}heartbeatInterval
The heartbeatInterval parameter is an Integer that defines the number of seconds between each heartbeat logged within Shardus.
{
"heartbeatInterval": 5
}baseDir
The baseDir parameter is a String that defines the relative base directory for this running instance of Shardus.
{
"baseDir": "."
}transactionExpireTime
The transactionExpireTime parameter is an Integer that defines the amount of time (in seconds) allowed to pass before a transaction will expire and be rejected by the network.
{
"transactionExpireTime": 5
}crypto
The crypto parameter is an Object which can pass in the following parameter:
"crypto": {
"hashKey": "69fa4195670576c0160d660c3be36556ff8d504725be8a59b5a96509e0c994bc"
}The
hashKeyparameter is aStringthat is used to initialize thecryptomodule, which is used for the cryptographic functions within Shardus.
p2p
The p2p parameter is an Object which can pass in the following parameters:
"p2p": {
"ipServer": "api.ipify.org/?format=json",
"timeServers": [
"0.pool.ntp.org",
"1.pool.ntp.org",
"2.pool.ntp.org",
"3.pool.ntp.org"
],
"syncLimit": 5,
"cycleDuration": 15,
"maxRejoinTime": 20,
"seedList": "http://127.0.0.1:4000/api/seednodes",
"difficulty": 2,
"queryDelay": 1,
"netadmin": "758b1c119412298802cd28dbfa394cdfeecc4074492d60844cc192d632d84de3",
"gossipRecipients": 4,
"gossipTimeout": 180,
"maxSeedNodes": 10,
"minNodes": 1,
"maxNodes": 20,
"seedNodeOffset": 4,
"nodeExpiryAge": 180,
"maxNodesToRotate": 1,
"maxNodesPerCycle": 5,
"maxPercentOfDelta": 40,
"scaleReqsNeeded": 5,
"maxScaleReqs": 10,
"amountToScale": 1
}The
ipServerparameter is aStringthat specifies the URL for the IP server.
The
timeServersparameter is anArrayofStrings that specifies where to get time critical data.
The
syncLimitparameter is anIntegerthat specifies the amount of time (in seconds) a node's local time can differ from the network's time.
The
cycleDurationparameter is anIntegerspecifying the amount of time (in seconds) it takes for a Shardus network cycle to complete.
The
maxRejoinTimeparameter is anIntegerspecifying the amount of time (in seconds) between network heartbeats before a node must ask to rejoin.
The
seedListparameter is aStringspecifying the URL for the seed node server that the application will communicate with.
The
difficultyparameter is anIntegerspecifying the proof of work difficulty to prevent network spam.
The
queryDelayparameter is anIntegerspecifying the amount of time (in seconds) to delay between cycle phases.
The
netadminparameter is aStringspecifying the public key of the network admin for emergency network alerts, updates, or broadcasts.
The
gossipRecipientsparameter is anIntegerspecifying the number of nodes to send gossip to in the network after receiving a message. Shardus groups nodes with neighbors, who they can gossip the message to, so you can set this pretty low and still expect it to be propagated through the entire network. (It's recommended to set this to at least 3, 4 is recommended, and 5 would be even safer, but maybe overkill.) Shardus will send 2 gossips to neighboring nodes, and send the remaining number left over in the parameter to random nodes in the network, so messages will be propagated very quickly.
The
gossipTimeoutparameter is anIntegerspecifying the amount of time (in seconds) before an old gossip is deleted from a node.
The
maxSeedNodesparameter is anIntegerspecifying the maximum number of seed nodes to be used.
The
minNodesparameter is anIntegerspecifying the minimum number of nodes that need to be active in the network in order to process transactions.
The
maxNodesparameter is anIntegerspecifying the maximum number of nodes that can be active in the network at once.
The
seedNodeOffsetparameter is anIntegerspecifying the number of seed nodes to remove when producing the seed list.
The
nodeExpiryAgeparameter is anIntegerspecifying the amount of time (in seconds) a node can be in the network before getting rotated out.
The
maxNodesToRotateparameter is anIntegerspecifying the maximum number of nodes that can be rotated out of the network.
The
maxNodesPerCycleparameter is anIntegerspecifying the maximum number of nodes that can join the syncing phase each cycle.
The
maxPercentOfDeltaparameter is anIntegerspecifying a percentage limit for additional nodes that can be accepted to the network.
The
scaleReqsNeededparameter is anIntegerspecyifying the number of internal scaling requests Shardus needs to receive before scaling up or down the number of desired nodes in the network.
The
maxScaleReqsparameter is anIntegerspecifying the maximum number of scaling requests the network will process before scaling up or down.
The
amountToScaleparameter is anIntegerspecifying the amount of nodes to add to or subtract from the number of desired nodes in the network.
ip
The ip parameter is an Object which can pass in the following parameters:
"ip": {
"externalIp": "127.0.0.1",
"externalPort": 9001,
"internalIp": "127.0.0.1",
"internalPort": 9005
}The
externalIpparameter is aStringspecifying the external IP address exposed by the node running the network.
The
externalPortparameter is anIntegerspecifying the external port exposed by the node running the network.
The
internalIpparameter is aStringspecifying the internal IP address exposed by the node running the network.
The
internalPortparameter is anIntegerspecifying the internal port exposed by the node running the network.
network
The network parameter is an Object which can pass in the following parameter:
"network": {
"timeout": 10
}The
timeoutparameter is anIntegerspecifying the amount of time (in seconds) given to an internal network request made by the node until it gets timed out.
reporting
The reporting parameter is an Object which can pass in the following parameters:
"reporting": {
"report": true,
"recipient": "http://127.0.0.1:3000/api",
"interval": 2,
"console": false
}The
reportparameter is aBooleanspecifying whether or not to report data to a monitor server / client.
The
recipientparameter is aStringspecifying the URL of the recipient of the data that will be reported ifreportis set totrue.
The
intervalparameter is anIntegerspecifying the amount of time (in seconds) between the reported data updates.
The
consoleparameter is aBooleanspecifying whether or not to report data updates to the console.
debug
The debug parameter is an Object which can pass in the following parameters:
"debug": {
"loseReceiptChance": 0.000,
"loseTxChance": 0.00
}The
loseReceiptChanceparameter is aFloatspecifying a percentage chance to randomly drop a receipt (currently doesn't do anything).
The
loseTxChanceparameter is aFloatspecifying a percentage chance to randomly drop a transaction.
statistics
The statistics parameter is an Object which can pass in the following parameters:
"statistics": {
"save": true,
"interval": 1
}The
saveparameter is aBooleanspecifying whether or not statistics will be gathered and saved when running the network.
The
intervalparameter is anIntegerspecifying the amount of time (in seconds) between each generation of stats data.
loadDetection
The loadDetection parameter is an Object which can pass in the following parameters:
"loadDetection": {
"queueLimit": 1000,
"desiredTxTime": 15,
"highThreshold": 0.5,
"lowThreshold": 0.2
}The
queueLimitparameter is anIntegerwhich specifies one of the two possible limits to check whether the network is under heavy load. It does this by checking its set value against the current transaction queue. The threshold will be equal to the number of transactions in the queue divided by thequeueLimit.
const scaledQueueLength =
queueLength >= this.queueLimit ? 1 : queueLength / this.queueLimit;The
desiredTxTimeparameter is anIntegerwhich specifies the other condition to check whether the network is under heavy load.
const scaledTxTimeInQueue =
txTimeInQueue >= this.desiredTxTime ? 1 : txTimeInQueue / this.desiredTxTime;The
highThresholdparameter is anIntegerwhich specifies the high end of the load the network can take. Reaching this threshold will cause the network to increase the number of desired nodes.
The
lowThresholdparameter is anIntegerwhich specifies the low end of the load the network can take. Reaching this threshold will cause the network to decrease the number of desired nodes.
rateLimiting
The rateLimiting parameter is an Object which can pass in the following parameters:
"rateLimiting": {
"limitRate": true,
"loadLimit": 0.5
}The
limitRateparameter is aBooleanindicating whether or not the network should rate limit in any way.
The
loadLimitparameter is aFloat(between 0 and 1) indicating the maximum level of load the network can handle before starting to drop transactions. WithloadLimitset to0.5, at 75% or0.75load, the network would drop 33% of incoming transactions. (The percentage chance to drop a transaction scales linearly as the load increases past the threshold.)
stateManager
The stateManager parameter is an Object which can pass in the following parameters:
"stateManager": {
"stateTableBucketSize": 200,
"accountBucketSize": 50
}The
stateTableBucketSizeparameter is anIntegerwhich defines the max number of account records that thep2pmodule will ask for in itsget_account_statecall.
The
accountBucketSizeparameter is anIntegerthat is also currently used as input to a p2paskmethod for the max number of account records.
sharding
The sharding parameter is an Object which contains the following property:
"sharding": {
"nodesPerConsensusGroup": 5
}The
nodesPerConsensusGroupproperty is anInteger.