-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbsv-p2p.js
37 lines (31 loc) · 1.32 KB
/
bsv-p2p.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
const { Master, Worker } = require("bsv-spv");
const cluster = require("cluster");
import listener from './src/bsv_spv/listener'
const port = 5200; // Server that new blocks nad mempool txs are announced on
const config = {
ticker: "BSV", // BTC, BCH, XEC, BSV
nodes: [
//`52.77.194.245:8333`,
`54.174.1.24:8333`,
`95.165.175.75:8333`,
`107.6.17.35:8333`,
`167.99.92.186:8333`,
`65.108.64.118:8333`
], // Set to your favorite node IP addresses. Will ask for other peers after connected
// enableIpv6: true, // Connect to ipv6 nodes
forceUserAgent: `Bitcoin SV`, // Disconnects with nodes that do not string match with user agent
// user_agent: 'Bitcoin SV',
invalidBlocks: [], // Set if you want to force a specific fork (see examples below)
dataDir: __dirname, // Directory to store files
pruneBlocks: 0, // Number of newest blocks you want saved to local disk. 0 to keeping all blocks back to genesis.
blockHeight: -10, // Sync to block height. 0 to sync to genesis. Negative to sync to X blocks from current heightafter 2 hours
mempool: 1, // Number of mempool tx threads
blocks: 1, // Number of bitcoin block threads
};
if (cluster.isWorker) {
const worker = new Worker();
} else if (cluster.isPrimary) {
const master = new Master(config);
master.startServer({ port });
}
listener()