-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupNodes.js
47 lines (40 loc) · 1.04 KB
/
setupNodes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const fs = require("fs");
const numberOfNodes = 10;
/*
This script will generate configuration for 10 full Ravencoin nodes
in sub folder fullnode_1, fullnode_2 etc etc.
RPC user name and passwords will be re-generated each time you run this script.
The nodes will be configured to index loads of stuff, such as assetindex=1
This can be optimized in the future, perhaps this is overkill
*/
function getRandom() {
return (
Math.random().toString(36).substring(2, 15) +
Math.random().toString(36).substring(2, 15)
);
}
function getConfig(nodeNumber) {
return `
addressindex=1
assetindex=1
dbcache=512
listen=1
port=${8870 + nodeNumber}
rpcallowip=127.0.0.1
rpcport=${19570 + nodeNumber}
rpcpassword=${getRandom()}
rpcuser=${getRandom()}
spentindex=1
server=1
txindex=1
timestampindex=1
upnp=1
whitelist=127.0.0.1
`;
}
for (let i = 1; i <= numberOfNodes; i++) {
const config = getConfig(i);
const dir = "./fullnode_" + i;
fs.mkdirSync(dir, { recursive: true });
fs.writeFileSync(dir + "/raven.conf", config);
}