Last active
October 5, 2021 23:58
-
-
Save ninabreznik/81b77543bd69b19a17f85452a22bcb55 to your computer and use it in GitHub Desktop.
Bootstrap hypercore protocol nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DHT = require('@hyperswarm/dht') | |
const bootstrapper1 = new DHT({ ephemeral: true }) | |
await bootstrapper1.bind(10001) | |
const bootstrapper2 = new DHT({ | |
bootstrap: [ | |
{ host: bootstrapper1.address().address, port: bootstrapper1.address().port }, | |
], | |
ephemeral: false | |
}) | |
await bootstrapper2.bind(10002) | |
/*-------------------------------*/ | |
const bootstrap_nodes = [ | |
{ host: bootstrapper1.address().address, port: bootstrapper1.address().port }, | |
{ host: bootstrapper2.address().address, port: bootstrapper2.address().port }, | |
] | |
const swarm = new hyperswarm({ bootstrap: bootstrap_nodes }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment