docs.waku.org/assets/js/309e91a3.3dd6071e.js
2025-10-03 05:55:52 +00:00

1 line
10 KiB
JavaScript

"use strict";(self.webpackChunkwaku_guide=self.webpackChunkwaku_guide||[]).push([[5766],{28453:(e,n,o)=>{o.d(n,{R:()=>d,x:()=>c});var s=o(96540);const i={},r=s.createContext(i);function d(e){const n=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:d(e.components),s.createElement(r.Provider,{value:n},e.children)}},99919:(e,n,o)=>{o.r(n),o.d(n,{assets:()=>t,contentTitle:()=>c,default:()=>h,frontMatter:()=>d,metadata:()=>s,toc:()=>l});const s=JSON.parse('{"id":"run-node/configure-discovery","title":"Configure Peer Discovery","description":"This guide provides detailed steps to configure a nwaku node to discover and connect with peers in the Waku Network.","source":"@site/docs/run-node/configure-discovery.md","sourceDirName":"run-node","slug":"/run-node/configure-discovery","permalink":"/run-node/configure-discovery","draft":false,"unlisted":false,"editUrl":"https://github.com/waku-org/docs.waku.org/tree/develop/docs/run-node/configure-discovery.md","tags":[],"version":"current","lastUpdatedAt":null,"frontMatter":{"title":"Configure Peer Discovery","hide_table_of_contents":true,"displayed_sidebar":"runNode"},"sidebar":"runNode","previous":{"title":"Build Nwaku from Source","permalink":"/run-node/build-source"},"next":{"title":"Find Your Node Address","permalink":"/run-node/find-node-address"}}');var i=o(74848),r=o(28453);const d={title:"Configure Peer Discovery",hide_table_of_contents:!0,displayed_sidebar:"runNode"},c=void 0,t={},l=[{value:"Configure static peers",id:"configure-static-peers",level:2},{value:"Configure DNS discovery",id:"configure-dns-discovery",level:2},{value:"Configure Discv5",id:"configure-discv5",level:2},{value:"Configure peer exchange",id:"configure-peer-exchange",level:2}];function a(e){const n={a:"a",admonition:"admonition",code:"code",h2:"h2",li:"li",p:"p",pre:"pre",ul:"ul",...(0,r.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.p,{children:["This guide provides detailed steps to configure a ",(0,i.jsx)(n.code,{children:"nwaku"})," node to discover and connect with peers in the Waku Network."]}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:["You can configure a ",(0,i.jsx)(n.code,{children:"nwaku"})," node to use multiple peer discovery mechanisms simultaneously."]})}),"\n",(0,i.jsx)(n.h2,{id:"configure-static-peers",children:"Configure static peers"}),"\n",(0,i.jsxs)(n.p,{children:["You can provide ",(0,i.jsx)(n.a,{href:"/learn/concepts/static-peers",children:"static peers"})," to a ",(0,i.jsx)(n.code,{children:"nwaku"})," node during startup using the ",(0,i.jsx)(n.code,{children:"staticnode"})," configuration option. To connect to multiple peers on startup, repeat the ",(0,i.jsx)(n.code,{children:"staticnode"})," option:"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 \\\n --staticnode=[PEER MULTIADDR 1] \\\n --staticnode=[PEER MULTIADDR 2]\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For example, consider a ",(0,i.jsx)(n.code,{children:"nwaku"})," node that connects to two static peers on the same local host (IP: ",(0,i.jsx)(n.code,{children:"0.0.0.0"}),") using TCP ports ",(0,i.jsx)(n.code,{children:"60002"})," and ",(0,i.jsx)(n.code,{children:"60003"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 \\\n --staticnode=/ip4/0.0.0.0/tcp/60002/p2p/16Uiu2HAkzjwwgEAXfeGNMKFPSpc6vGBRqCdTLG5q3Gmk2v4pQw7H \\\n --staticnode=/ip4/0.0.0.0/tcp/60003/p2p/16Uiu2HAmFBA7LGtwY5WVVikdmXVo3cKLqkmvVtuDu63fe8safeQJ\n"})}),"\n",(0,i.jsx)(n.h2,{id:"configure-dns-discovery",children:"Configure DNS discovery"}),"\n",(0,i.jsxs)(n.p,{children:["To enable ",(0,i.jsx)(n.a,{href:"/learn/concepts/dns-discovery",children:"DNS Discovery"})," in a ",(0,i.jsx)(n.code,{children:"nwaku"})," node, use the following configuration options:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"dns-discovery"}),": Enables ",(0,i.jsx)(n.code,{children:"DNS Discovery"})," on the node (disabled by default)."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"dns-discovery-url"}),": URL for DNS node list in the format ",(0,i.jsx)(n.code,{children:"enrtree://<key>@<fqdn>"})," where ",(0,i.jsx)(n.code,{children:"<fqdn>"})," is the fully qualified domain name and ",(0,i.jsx)(n.code,{children:"<key>"})," is the base32 encoding of the compressed 32-byte public key that signed the list at that location."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"dns-discovery-name-server"})," (optional): DNS name server IPs to query. You can repeat this option to provide multiple DNS name servers."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 \\\n --dns-discovery=true \\\n --dns-discovery-url=enrtree://[PUBLIC KEY]@[DOMAIN NAME] \\\n --dns-discovery-name-server=[DNS NAME SERVER IP]\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:["If you omit the ",(0,i.jsx)(n.code,{children:"dns-discovery-name-server"})," option, ",(0,i.jsx)(n.code,{children:"nwaku"})," will attempt to use the CloudFlare servers ",(0,i.jsx)(n.code,{children:"1.1.1.1"})," and ",(0,i.jsx)(n.code,{children:"1.0.0.1"}),"."]})}),"\n",(0,i.jsxs)(n.p,{children:["For example, consider a ",(0,i.jsx)(n.code,{children:"nwaku"})," node that enables ",(0,i.jsx)(n.code,{children:"DNS Discovery"}),", connects to a DNS node list, and queries the IPs ",(0,i.jsx)(n.code,{children:"8.8.8.8"})," and ",(0,i.jsx)(n.code,{children:"8.8.4.4"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 \\\n --dns-discovery=true \\\n --dns-discovery-url=enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im \\\n --dns-discovery-name-server=8.8.8.8 \\\n --dns-discovery-name-server=8.8.4.4\n"})}),"\n",(0,i.jsx)(n.h2,{id:"configure-discv5",children:"Configure Discv5"}),"\n",(0,i.jsxs)(n.p,{children:["To enable ",(0,i.jsx)(n.a,{href:"/learn/concepts/discv5",children:"Discv5"})," in a ",(0,i.jsx)(n.code,{children:"nwaku"})," node, use the following configuration options:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"discv5-discovery"}),": Enables ",(0,i.jsx)(n.code,{children:"Discv5"})," on the node (disabled by default)."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"discv5-bootstrap-node"}),": ENR for ",(0,i.jsx)(n.code,{children:"Discv5"})," routing table bootstrap node. You can repeat this option to provide multiple bootstrap entries."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 \\\n --discv5-discovery=true \\\n --discv5-bootstrap-node=[DISCV5 ENR BOOTSTRAP ENTRY 1] \\\n --discv5-bootstrap-node=[DISCV5 ENR BOOTSTRAP ENTRY 2]\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For example, consider a ",(0,i.jsx)(n.code,{children:"nwaku"})," node that enables ",(0,i.jsx)(n.code,{children:"Discv5"})," and bootstraps its routing table using a static ",(0,i.jsx)(n.code,{children:"ENR"}),":"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 \\\n --discv5-discovery=true \\\n --discv5-bootstrap-node=enr:-IO4QDxToTg86pPCK2KvMeVCXC2ADVZWrxXSvNZeaoa0JhShbM5qed69RQz1s1mWEEqJ3aoklo_7EU9iIBcPMVeKlCQBgmlkgnY0iXNlY3AyNTZrMaEDdBHK1Gx6y_zv5DVw5Qb3DtSOMmVHTZO1WSORrF2loL2DdWRwgiMohXdha3UyAw\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:["When Discv5 is enabled and used with ",(0,i.jsx)(n.a,{href:"#configure-dns-discovery",children:"DNS Discovery"}),", the ",(0,i.jsx)(n.code,{children:"nwaku"})," node will attempt to bootstrap the Discv5 routing table by extracting ",(0,i.jsx)(n.code,{children:"ENRs"})," from peers discovered through DNS."]})}),"\n",(0,i.jsx)(n.h2,{id:"configure-peer-exchange",children:"Configure peer exchange"}),"\n",(0,i.jsxs)(n.p,{children:["To enable ",(0,i.jsx)(n.a,{href:"/learn/concepts/peer-exchange",children:"Peer Exchange"})," in a ",(0,i.jsx)(n.code,{children:"nwaku"})," node, use the following configuration options:"]}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"peer-exchange"}),": Enables ",(0,i.jsx)(n.code,{children:"Peer Exchange"})," on the node as a responder (disabled by default)."]}),"\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"peer-exchange-node"})," (optional): Multiaddr for bootstrap node with the peer exchange protocol enabled."]}),"\n"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",children:"./build/wakunode2 \\\n --peer-exchange=true \\\n --peer-exchange-node=[PEER MULTIADDR WITH EXCHANGE ENABLED]\n"})}),"\n",(0,i.jsxs)(n.p,{children:["For example, consider two ",(0,i.jsx)(n.code,{children:"nwaku"})," nodes configured as a ",(0,i.jsx)(n.code,{children:"server"})," (peer exchange responder node) and ",(0,i.jsx)(n.code,{children:"client"})," (node using peer exchange) on the same local host (IP: ",(0,i.jsx)(n.code,{children:"0.0.0.0"}),"):"]}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",metastring:'title="Server: Nwaku Node with Peer Exchange Enabled"',children:"./build/wakunode2 --peer-exchange=true\n"})}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsx)(n.code,{className:"language-shell",metastring:'title="Client: Nwaku Node Bootstrapping with Peer Exchange"',children:"./build/wakunode2 \\\n --tcp-port=30305 \\\n --ports-shift=1 \\\n --peer-exchange-node=/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmLCe6zVqCS6KMqqRbbhyoJjfYZGr1Q3thTSbyKzibQkFR\n"})}),"\n",(0,i.jsx)(n.admonition,{type:"info",children:(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"nwaku"})," provides a ",(0,i.jsx)(n.a,{href:"/run-node/config-options#relay-config",children:(0,i.jsx)(n.code,{children:"relay-peer-exchange"})})," option via ",(0,i.jsx)(n.code,{children:"libp2p"})," for peer exchange, allowing network growth through neighbouring nodes. However, this feature can compromise security and network robustness, so we recommend only using it in high-trust environments."]})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}}}]);