Skip to content

Commit b1fb023

Browse files
author
Christos KK Loverdos
committed
Add universal configuration for a custom private testnet
1 parent 36c0368 commit b1fb023

File tree

4 files changed

+98
-3
lines changed

4 files changed

+98
-3
lines changed

src/main/scala/io/iohk/ethereum/consensus/atomixraft/AtomixRaftConfig.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ object AtomixRaftConfig extends Logger {
4545
case _ throw new IllegalArgumentException("parts.length != 1, 2, 3")
4646
}
4747

48+
//noinspection ScalaStyle
4849
def parseNode(id_host_port: String): AtomixNode = {
4950
val parts = id_host_port.split(":")
51+
log.info(s"atomix-raft: id_host_port = ${id_host_port} => parts = ${parts.toList}")
5052
val nodeId = parseNodeId(parts)
5153
val endpoint = parseEndpoint(parts)
5254

src/universal/conf/mantis.conf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ include "misc.conf"
1616
include "consensus.conf"
1717

1818
# Uncomment the following include to connect to the Ethereum Hard-Fork network.
19-
# Note that any settings in this file will override the ones defined in the files above
19+
# Note that any settings in this file will override the ones defined in the files above.
2020
# include "ethereumHF.conf"
2121

2222
# Uncomment the following include to connect to the testnet Morden.
23-
# Note that any settings in this file will override the ones defined in the files above
23+
# Note that any settings in this file will override the ones defined in the files above.
2424
# include "morden.conf"
2525

2626
# Uncomment the following include to connect to the testnet Ropsten.
27-
# Note that any settings in this file will override the ones defined in the files above
27+
# Note that any settings in this file will override the ones defined in the files above.
2828
# include "ropsten.conf"
29+
30+
# Uncomment the following include to connect to your custom private testnet.
31+
# Note that any settings in this file will override the ones defined in the files above.
32+
# include "private-testnet.conf"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extraData": "0x00",
3+
"nonce": "0x0000000000000042",
4+
"gasLimit": "0x2fefd8",
5+
"difficulty": "0x400",
6+
"ommersHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
7+
"timestamp": "0x00",
8+
"coinbase": "0x0000000000000000000000000000000000000000",
9+
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
10+
"alloc": {
11+
"d7a681378321f472adffb9fdded2712f677e0ba9": {
12+
"balance": "1606938044258990275541962092341162602522202993782792835301376"
13+
}
14+
}
15+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Sample configuration for a custom private testnet.
2+
mantis {
3+
sync {
4+
# Whether to enable fast-sync
5+
do-fast-sync = false
6+
7+
# Duration for blacklisting a peer. Blacklisting reason include: invalid response from peer, response time-out, etc.
8+
# 0 value is a valid duration and it will disable blacklisting completely (which can be useful when all nodes are
9+
# are controlled by a single party, eg. private networks)
10+
blacklist-duration = 0
11+
12+
# Set to false to disable broadcasting the NewBlockHashes message, as its usefulness is debatable,
13+
# especially in the context of private networks
14+
broadcast-new-block-hashes = false
15+
}
16+
17+
blockchain {
18+
# DAO fork configuration (Ethereum HF/Classic split)
19+
# https://blog.ethereum.org/2016/07/20/hard-fork-completed/
20+
dao = null
21+
22+
# Custom genesis JSON file
23+
# null value indicates using default genesis definition that matches the main network
24+
custom-genesis-file = "conf/private-genesis.json"
25+
}
26+
27+
network {
28+
discovery {
29+
# Listening interface for discovery protocol
30+
interface = ${mantis.network.server-address.interface}
31+
}
32+
33+
peer {
34+
# Ethereum network identifier:
35+
# 1 - mainnet, 2 - morden
36+
network-id = 2139
37+
}
38+
39+
rpc {
40+
# JSON-RPC mode
41+
# Available modes are: http, https
42+
# Choosing https requires creating a certificate and setting up 'certificate-keystore-path' and
43+
# 'certificate-password-file'
44+
# See: https://github.com/input-output-hk/mantis/wiki/Creating-self-signed-certificate-for-using-JSON-RPC-with-HTTPS
45+
mode = "http"
46+
47+
# Listening address of JSON-RPC HTTP/HTTPS endpoint
48+
interface = ${mantis.network.server-address.interface}
49+
50+
# Domains allowed to query RPC endpoint. Use "*" to enable requests from any domain.
51+
cors-allowed-origins = []
52+
}
53+
54+
# This is the section dedicated to `atomix-raft` consensus.
55+
# This consensus protocol is selected by setting `mantis.consensus.protocol = atomix-raft`.
56+
atomix-raft {
57+
election-timeout = 30.seconds
58+
59+
# Determines how often new blocks will be forged
60+
block-forging-delay = 15.seconds
61+
62+
# Represents this node.
63+
#
64+
# ID and PORT are not mandatory.
65+
# If PORT is not given, then is assumes the value of
66+
# io.atomix.messaging.impl.NettyMessagingService.DEFAULT_PORT, which currently is 5679.
67+
# If ID is not given, then its value becomes IP_PORT.
68+
local-node = ${mantis.network.server-address.interface}
69+
70+
# All the other nodes in the cluster, in the same format as with `local-node`.
71+
bootstrap-nodes = []
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)