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
hashKey
parameter is aString
that is used to initialize thecrypto
module, 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
ipServer
parameter is aString
that specifies the URL for the IP server.
The
timeServers
parameter is anArray
ofString
s that specifies where to get time critical data.
The
syncLimit
parameter is anInteger
that specifies the amount of time (in seconds) a node's local time can differ from the network's time.
The
cycleDuration
parameter is anInteger
specifying the amount of time (in seconds) it takes for a Shardus network cycle to complete.
The
maxRejoinTime
parameter is anInteger
specifying the amount of time (in seconds) between network heartbeats before a node must ask to rejoin.
The
seedList
parameter is aString
specifying the URL for the seed node server that the application will communicate with.
The
difficulty
parameter is anInteger
specifying the proof of work difficulty to prevent network spam.
The
queryDelay
parameter is anInteger
specifying the amount of time (in seconds) to delay between cycle phases.
The
netadmin
parameter is aString
specifying the public key of the network admin for emergency network alerts, updates, or broadcasts.
The
gossipRecipients
parameter is anInteger
specifying 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
gossipTimeout
parameter is anInteger
specifying the amount of time (in seconds) before an old gossip is deleted from a node.
The
maxSeedNodes
parameter is anInteger
specifying the maximum number of seed nodes to be used.
The
minNodes
parameter is anInteger
specifying the minimum number of nodes that need to be active in the network in order to process transactions.
The
maxNodes
parameter is anInteger
specifying the maximum number of nodes that can be active in the network at once.
The
seedNodeOffset
parameter is anInteger
specifying the number of seed nodes to remove when producing the seed list.
The
nodeExpiryAge
parameter is anInteger
specifying the amount of time (in seconds) a node can be in the network before getting rotated out.
The
maxNodesToRotate
parameter is anInteger
specifying the maximum number of nodes that can be rotated out of the network.
The
maxNodesPerCycle
parameter is anInteger
specifying the maximum number of nodes that can join the syncing phase each cycle.
The
maxPercentOfDelta
parameter is anInteger
specifying a percentage limit for additional nodes that can be accepted to the network.
The
scaleReqsNeeded
parameter is anInteger
specyifying the number of internal scaling requests Shardus needs to receive before scaling up or down the number of desired nodes in the network.
The
maxScaleReqs
parameter is anInteger
specifying the maximum number of scaling requests the network will process before scaling up or down.
The
amountToScale
parameter is anInteger
specifying 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
externalIp
parameter is aString
specifying the external IP address exposed by the node running the network.
The
externalPort
parameter is anInteger
specifying the external port exposed by the node running the network.
The
internalIp
parameter is aString
specifying the internal IP address exposed by the node running the network.
The
internalPort
parameter is anInteger
specifying 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
timeout
parameter is anInteger
specifying 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
report
parameter is aBoolean
specifying whether or not to report data to a monitor server / client.
The
recipient
parameter is aString
specifying the URL of the recipient of the data that will be reported ifreport
is set totrue
.
The
interval
parameter is anInteger
specifying the amount of time (in seconds) between the reported data updates.
The
console
parameter is aBoolean
specifying 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
loseReceiptChance
parameter is aFloat
specifying a percentage chance to randomly drop a receipt (currently doesn't do anything).
The
loseTxChance
parameter is aFloat
specifying 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
save
parameter is aBoolean
specifying whether or not statistics will be gathered and saved when running the network.
The
interval
parameter is anInteger
specifying 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
queueLimit
parameter is anInteger
which 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
desiredTxTime
parameter is anInteger
which specifies the other condition to check whether the network is under heavy load.
const scaledTxTimeInQueue =
txTimeInQueue >= this.desiredTxTime ? 1 : txTimeInQueue / this.desiredTxTime;
The
highThreshold
parameter is anInteger
which 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
lowThreshold
parameter is anInteger
which 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
limitRate
parameter is aBoolean
indicating whether or not the network should rate limit in any way.
The
loadLimit
parameter is aFloat
(between 0 and 1) indicating the maximum level of load the network can handle before starting to drop transactions. WithloadLimit
set to0.5
, at 75% or0.75
load, 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
stateTableBucketSize
parameter is anInteger
which defines the max number of account records that thep2p
module will ask for in itsget_account_state
call.
The
accountBucketSize
parameter is anInteger
that is also currently used as input to a p2pask
method for the max number of account records.
sharding
The sharding
parameter is an Object
which contains the following property:
"sharding": {
"nodesPerConsensusGroup": 5
}
The
nodesPerConsensusGroup
property is anInteger
.