Bootstrap Nodes and Discover PeersThis guide provides detailed steps to bootstrap your your node using Static Peers and discover peers in the Waku Network using DNS Discovery. + ) .lsd-dropdown__trigger:focus .lsd-dropdown__option-label{-webkit-text-decoration:underline;text-decoration:underline;}.lsd-dropdown__label{display:block;}.lsd-dropdown__button-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;}.lsd-dropdown__trigger{width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;border:none;cursor:pointer;background:none;}.lsd-dropdown__trigger:focus{outline:none;}.lsd-dropdown__option-label{cursor:inherit;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.lsd-dropdown__icons{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;gap:8px;}.lsd-dropdown__icon{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.lsd-dropdown__supporting-text{margin:6px 14px;}.lsd-dropdown--error .lsd-dropdown__option-label{-webkit-text-decoration:line-through;text-decoration:line-through;}.lsd-dropdown--disabled{opacity:0.34;cursor:initial;}.lsd-dropdown--large{width:208px;}.lsd-dropdown--large.lsd-dropdown--error{width:230px;}.lsd-dropdown--large .lsd-dropdown__label{margin:0 0 6px 18px;}.lsd-dropdown--large .lsd-dropdown__button-container{height:40px;}.lsd-dropdown--large .lsd-dropdown__trigger{padding:10px 0px 10px 18px;}.lsd-dropdown--large .lsd-dropdown__icons{padding:0px 14px;}.lsd-dropdown--medium{width:188px;}.lsd-dropdown--medium.lsd-dropdown--error{width:210px;}.lsd-dropdown--medium .lsd-dropdown__label{margin:0 0 6px 14px;}.lsd-dropdown--medium .lsd-dropdown__button-container{height:32px;}.lsd-dropdown--medium .lsd-dropdown__trigger{padding:6px 0px 6px 14px;}.lsd-dropdown--medium .lsd-dropdown__icons{padding:0px 12px;}.lsd-dropdown--small{width:164px;}.lsd-dropdown--small.lsd-dropdown--error{width:186px;}.lsd-dropdown--small .lsd-dropdown__label{margin:0 0 6px 12px;}.lsd-dropdown--small .lsd-dropdown__button-container{height:28px;}.lsd-dropdown--small .lsd-dropdown__trigger{padding:6px 0px 6px 12px;}.lsd-dropdown--small .lsd-dropdown__icons{padding:0px 10px;}.lsd-dropdown--outlined .lsd-dropdown__button-container{border:1px solid rgb(var(--lsd-border-primary));}.lsd-dropdown--underlined .lsd-dropdown__button-container{border:1px solid transparent;border-bottom:1px solid rgb(var(--lsd-border-primary));}Skip to main contentBuildRun NodeLearnDiscordBootstrap Nodes and Discover PeersThis guide provides detailed steps to bootstrap your your node using Static Peers and discover peers in the Waku Network using DNS Discovery. infoIf you do not set up a bootstrap node or discovery mechanism, your node will not connect to any remote peer. tipUntil node incentivisation is in place, you should operate extra nodes alongside the ones provided by the Waku Network. When running a node, we recommend using the DNS Discovery and Static Peers configuration to connect to both the Waku Network and your node. Default bootstrap method @@ -42,6 +42,6 @@ import { createLightNode } from "@waku/sdk";import { bootstrap } from "@libp2p/bootstrap";import { enrTree, wakuDnsDiscovery } from "@waku/dns-discovery";// Define the list of static peers to bootstrapconst peers = [ "/ip4/0.0.0.0/tcp/60002/ws/p2p/16Uiu2HAkzjwwgEAXfeGNMKFPSpc6vGBRqCdTLG5q3Gmk2v4pQw7H", "/ip4/0.0.0.0/tcp/60003/ws/p2p/16Uiu2HAmFBA7LGtwY5WVVikdmXVo3cKLqkmvVtuDu63fe8safeQJ",];// Define node requirementsconst NODE_REQUIREMENTS = { store: 3, lightPush: 3, filter: 3,};// Bootstrap node using DNS Discovery and static peersconst node = await createLightNode({ libp2p: { bootstrapPeers: peers, peerDiscovery: [wakuDnsDiscovery([enrTree["PROD"]], NODE_REQUIREMENTS)], },}); Retrieving connected peers You can retrieve the array of peers connected to a node using the libp2p.getPeers() function within the @waku/sdk package: -import { createLightNode } from "@waku/sdk";const node = await createLightNode({ defaultBootstrap: true });await node.waitForPeers();// Retrieve array of peers connected to the nodeconsole.log(node.libp2p.getPeers());Scaffold DApps Using @waku/create-appRun @waku/sdk in a NodeJS Application +import { createLightNode } from "@waku/sdk";const node = await createLightNode({ defaultBootstrap: true });await node.waitForPeers();// Retrieve array of peers connected to the nodeconsole.log(node.libp2p.getPeers());
Bootstrap Nodes and Discover PeersThis guide provides detailed steps to bootstrap your your node using Static Peers and discover peers in the Waku Network using DNS Discovery. infoIf you do not set up a bootstrap node or discovery mechanism, your node will not connect to any remote peer. tipUntil node incentivisation is in place, you should operate extra nodes alongside the ones provided by the Waku Network. When running a node, we recommend using the DNS Discovery and Static Peers configuration to connect to both the Waku Network and your node. Default bootstrap method @@ -42,6 +42,6 @@ import { createLightNode } from "@waku/sdk";import { bootstrap } from "@libp2p/bootstrap";import { enrTree, wakuDnsDiscovery } from "@waku/dns-discovery";// Define the list of static peers to bootstrapconst peers = [ "/ip4/0.0.0.0/tcp/60002/ws/p2p/16Uiu2HAkzjwwgEAXfeGNMKFPSpc6vGBRqCdTLG5q3Gmk2v4pQw7H", "/ip4/0.0.0.0/tcp/60003/ws/p2p/16Uiu2HAmFBA7LGtwY5WVVikdmXVo3cKLqkmvVtuDu63fe8safeQJ",];// Define node requirementsconst NODE_REQUIREMENTS = { store: 3, lightPush: 3, filter: 3,};// Bootstrap node using DNS Discovery and static peersconst node = await createLightNode({ libp2p: { bootstrapPeers: peers, peerDiscovery: [wakuDnsDiscovery([enrTree["PROD"]], NODE_REQUIREMENTS)], },}); Retrieving connected peers You can retrieve the array of peers connected to a node using the libp2p.getPeers() function within the @waku/sdk package: -import { createLightNode } from "@waku/sdk";const node = await createLightNode({ defaultBootstrap: true });await node.waitForPeers();// Retrieve array of peers connected to the nodeconsole.log(node.libp2p.getPeers());