mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-03 21:33:05 +00:00
chore: update doc for setting static peers
This commit is contained in:
parent
150e5b1f09
commit
f62e7d6459
@ -26,43 +26,16 @@ const node = await createLightNode({ defaultBootstrap: true });
|
|||||||
|
|
||||||
## Configure static peers
|
## Configure static peers
|
||||||
|
|
||||||
To bootstrap a node using [static peers](/learn/concepts/static-peers), first install the `@libp2p/bootstrap` package:
|
To set [static peers](/learn/concepts/static-peers) `bootstrapPeers` parameter should be passed to `createLightNode`.
|
||||||
|
|
||||||
```mdx-code-block
|
`bootstrapPeers` accepts a list of `multiaddr` to bootstrap the node:
|
||||||
import Tabs from '@theme/Tabs';
|
|
||||||
import TabItem from '@theme/TabItem';
|
|
||||||
```
|
|
||||||
|
|
||||||
<Tabs groupId="package-manager">
|
|
||||||
<TabItem value="npm" label="NPM">
|
|
||||||
|
|
||||||
```shell
|
|
||||||
npm install @libp2p/bootstrap
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
<TabItem value="yarn" label="Yarn">
|
|
||||||
|
|
||||||
```shell
|
|
||||||
yarn add @libp2p/bootstrap
|
|
||||||
```
|
|
||||||
|
|
||||||
</TabItem>
|
|
||||||
</Tabs>
|
|
||||||
|
|
||||||
Then, use the `bootstrap()` function to provide a list of `multiaddr` to bootstrap the node:
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { createLightNode } from "@waku/sdk";
|
import { createLightNode } from "@waku/sdk";
|
||||||
import { bootstrap } from "@libp2p/bootstrap";
|
|
||||||
|
|
||||||
// Bootstrap node using static peers
|
// Bootstrap node using static peers
|
||||||
const node = await createLightNode({
|
const node = await createLightNode({
|
||||||
libp2p: {
|
bootstrapPeers: ["[PEER MULTIADDR]"],
|
||||||
peerDiscovery: [
|
|
||||||
bootstrap({ list: ["[PEER MULTIADDR]"] }),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -77,11 +50,7 @@ const peers = [
|
|||||||
|
|
||||||
// Bootstrap node using the static peers
|
// Bootstrap node using the static peers
|
||||||
const node = await createLightNode({
|
const node = await createLightNode({
|
||||||
libp2p: {
|
bootstrapPeers: peers,
|
||||||
peerDiscovery: [
|
|
||||||
bootstrap({ list: peers }),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user