add FAQ sections for nwaku and js-waku docs (#176)
This commit is contained in:
parent
66aef1b1de
commit
150e5b1f09
|
@ -79,6 +79,7 @@
|
|||
"txid",
|
||||
"baarerstrasse",
|
||||
"FDPIC",
|
||||
"IPFS",
|
||||
],
|
||||
"flagWords": [],
|
||||
"ignorePaths": [
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
title: JavaScript SDK FAQ
|
||||
hide_table_of_contents: true
|
||||
sidebar_label: Frequently Asked Questions
|
||||
---
|
||||
|
||||
import { AccordionItem } from '@site/src/components/mdx'
|
||||
|
||||
<AccordionItem title="How do I install the @waku/sdk package in my project?">
|
||||
You can add the JavaScript SDK to your project using NPM, Yarn, or a CDN. Check out the <a href="/guides/js-waku/#installation">installation guide</a> to get started.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="Why should I use Protocol Buffers for my application's message structure when using Waku?">
|
||||
Protocol Buffers ensure consistent formatting, interoperability, and backward compatibility for your application's messages, with a smaller payload size than JSON. Check out the <a href="/guides/js-waku/#message-structure">installation guide</a> and <a href="https://protobuf.dev/overview/">Protobuf documentation</a> to learn more.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="What are the steps to retrieve historical messages on Waku?">
|
||||
Check out the <a href="/guides/js-waku/store-retrieve-messages">Retrieve Messages Using Store Protocol</a> guide to learn how to retrieve and filter historical messages using the <a href="/learn/concepts/protocols#store">Store protocol</a>.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I prevent Store peers from persisting my messages?">
|
||||
When <a href="/guides/js-waku/light-send-receive#choose-a-content-topic">creating your message encoder</a>, you can configure the <strong>ephemeral</strong> option to prevent Store peers from keeping your messages on the Waku Network.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I encrypt, decrypt, and sign messages in my Waku application?">
|
||||
You can encrypt and decrypt your messages using symmetric, ECIES, and noise encryption methods. Check out the <a href="/guides/js-waku/message-encryption">Encrypt, Decrypt, and Sign Your Messages</a> guide to get started.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How do I integrate Waku into a React application?">
|
||||
Waku has a specialized SDK designed for building React applications. Check out the <a href="/guides/js-waku/use-waku-react">Build React DApps Using @waku/react</a> guide for instructions on installation and usage.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I bootstrap and discover peers in the Waku Network for browser nodes?">
|
||||
The JavaScript SDK has a <a href="/guides/js-waku/configure-discovery#default-bootstrap-method">default bootstrap method</a> that can be configured with <a href="/learn/concepts/static-peers">Static Peers</a> and <a href="/learn/concepts/dns-discovery">DNS Discovery</a>. Check out the <a href="/guides/js-waku/configure-discovery">Bootstrap Nodes and Discover Peers</a> guide for setting up peer discovery for your node.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I integrate Waku into a NodeJS application?">
|
||||
Though the JavaScript SDK isn't directly usable in NodeJS due to <a href="/guides/js-waku/run-waku-nodejs">certain limitations</a>, we recommend running <a href="/guides/nwaku/run-docker-compose">nwaku in a Docker container</a> and consuming its <a href="https://waku-org.github.io/waku-rest-api/">REST API</a> in a NodeJS application.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I debug my Waku DApp and check WebSocket connections?">
|
||||
Check out the <a href="/guides/js-waku/debug-waku-dapp">Debug Your Waku DApp and WebSocket</a> guide to discover how to use debug logs to troubleshoot your Waku DApp and resolve connection issues with nwaku WebSockets.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I manage unexpected disconnections of my Filter subscription from Waku?">
|
||||
We recommend regularly pinging peers to check for an active connection and reinitiating the subscription when it disconnects. Check out the <a href="/guides/js-waku/manage-filter">Manage Your Filter Subscriptions</a> guide for a detailed explanation and step-by-step instructions.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I send images and videos on the Waku Network?">
|
||||
While it's possible to transmit media such as images as bytes on Waku, we recommend uploading your media to a CDN or a file system like <a href="https://ipfs.tech/">IPFS</a> and then sharing the corresponding URL via Waku.
|
||||
</AccordionItem>
|
|
@ -62,12 +62,12 @@ const encoder = createEncoder({ contentTopic });
|
|||
const decoder = createDecoder(contentTopic);
|
||||
```
|
||||
|
||||
The `ephemeral` option allows you to specify whether messages should not be stored by [Store peers](/guides/js-waku/store-retrieve-messages):
|
||||
The `ephemeral` option allows you to specify whether messages should **NOT** be stored by [Store peers](/guides/js-waku/store-retrieve-messages):
|
||||
|
||||
```js
|
||||
const encoder = createEncoder({
|
||||
contentTopic: contentTopic, // message content topic
|
||||
ephemeral: true, // allows messages not be stored on the network
|
||||
ephemeral: true, // allows messages NOT be stored on the network
|
||||
});
|
||||
```
|
||||
|
||||
|
|
|
@ -171,15 +171,11 @@ await subscription.subscribe([ECIESEncoder], callback);
|
|||
await node.lightPush.send(ECIESEncoder, { payload });
|
||||
```
|
||||
|
||||
You can extract the `signature` and its public key (`signaturePublicKey`) from the [DecodedMessage](https://js.waku.org/classes/_waku_message_encryption.DecodedMessage.html) and compare it with the expected public key to verify the message origin:
|
||||
|
||||
<!-- or use the `verifySignature()` function -->
|
||||
<!-- if (wakuMessage.verifySignature(alicePublicKey)) { -->
|
||||
You can extract the `signature` and its public key (`signaturePublicKey`) from the [DecodedMessage](https://js.waku.org/classes/_waku_message_encryption.DecodedMessage.html) and compare it with the expected public key or use the `verifySignature()` function to verify the message origin:
|
||||
|
||||
```js title="Bob (receiver) client"
|
||||
import { generatePrivateKey } from "@waku/message-encryption";
|
||||
import { createEncoder } from "@waku/message-encryption/symmetric";
|
||||
import { equals } from "uint8arrays/equals";
|
||||
|
||||
// Generate a random private key for signing messages
|
||||
// For this example, we'll call the receiver of the message Bob
|
||||
|
@ -201,7 +197,7 @@ const callback = (wakuMessage) => {
|
|||
|
||||
// Verify the message was actually signed and sent by Alice
|
||||
// Alice's public key can be gotten from broadcasting or out-of-band methods
|
||||
if (equals(signaturePublicKey, alicePublicKey)) {
|
||||
if (wakuMessage.verifySignature(alicePublicKey)) {
|
||||
console.log("This message was signed by Alice");
|
||||
} else {
|
||||
console.log("This message was NOT signed by Alice");
|
||||
|
|
|
@ -27,7 +27,7 @@ Certain features in `@waku/sdk` are tailored for browsers and might not translat
|
|||
|
||||
## Recommendations
|
||||
|
||||
Before using `@waku/sdk` in a NodeJS environment, take into account these limitations. For a more optimised solution, we recommend [running nwaku in a Docker container](/guides/nwaku/run-docker) and consuming its [REST API](https://waku-org.github.io/waku-rest-api/).
|
||||
Before using `@waku/sdk` in a NodeJS environment, take into account these limitations. For a more optimised solution, we recommend [running nwaku in a Docker container](/guides/nwaku/run-docker-compose) and consuming its [REST API](https://waku-org.github.io/waku-rest-api/).
|
||||
|
||||
## Future developments
|
||||
|
||||
|
|
|
@ -294,5 +294,5 @@ To explore the available Store query options, have a look at the [Retrieve Messa
|
|||
:::
|
||||
|
||||
:::tip
|
||||
You have successfully integrated `@waku/sdk` into a React application using the `@waku/react` package. Have a look at the [web-chat](https://github.com/waku-org/js-waku-examples/tree/master/examples/web-chat) example for a working demo.
|
||||
You have successfully integrated `@waku/sdk` into a React application using the `@waku/react` package. Have a look at the [web-chat](https://github.com/waku-org/js-waku-examples/tree/master/examples/web-chat) example for a working demo and the [Building a Tic-Tac-Toe Game with Waku](https://blog.waku.org/tictactoe-tutorial) tutorial to learn more.
|
||||
:::
|
|
@ -161,7 +161,7 @@ sudo certbot certonly -d <your.domain.name>
|
|||
|
||||
## Configure REST API server
|
||||
|
||||
Nwaku provides a REST API to interact with the node and Waku Network. To enable the REST API, use the following configuration options:
|
||||
Nwaku provides a [REST API](https://waku-org.github.io/waku-rest-api/) to interact with the node and Waku Network. To enable the REST API, use the following configuration options:
|
||||
|
||||
- `rest`: Enables the REST API server on the node (disabled by default).
|
||||
- `rest-address` (optional): Listening address of the REST API server. If you omit this option, it will default to `127.0.0.1`.
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: Nwaku FAQ
|
||||
hide_table_of_contents: true
|
||||
sidebar_label: Frequently Asked Questions
|
||||
---
|
||||
|
||||
import { AccordionItem } from '@site/src/components/mdx'
|
||||
|
||||
<AccordionItem title="How can I run a Waku node?">
|
||||
Check out the <a href="/guides/nwaku/run-docker-compose">Run Nwaku with Docker Compose</a> guide to learn the simplest and fastest way to run a node. You can also check the comprehensive <a href="/guides/nwaku/run-node">Run a Nwaku Node</a> guide to explore other options like <a href="/guides/nwaku/run-node#download-the-binary">downloading binaries</a> and <a href="/guides/nwaku/build-source">building from source</a>.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="What are the system requirements for running a node?">
|
||||
We recommend running a nwaku node with at least 2GB of RAM, especially if WSS is enabled. If running just a Relay node, 0.5GB of RAM is sufficient.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I interact with my running nwaku node?">
|
||||
You can interact with a running nwaku node using the <a href="https://waku-org.github.io/waku-rest-api/">REST API interface</a> or the <a href="/guides/js-waku/">JavaScript Waku SDK</a>.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I view the logs of a nwaku node running in Docker?">
|
||||
To check your node logs in Docker, use the command: "docker-compose logs -f nwaku"
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="What configuration methods are available for nwaku nodes?">
|
||||
You can configure Nwaku nodes using command line options and flags, environment variables, and TOML configuration files. Check out the <a href="/guides/nwaku/config-methods">Node Configuration Methods</a> guide to understand their usage and priority.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How can I configure my nwaku node before running?">
|
||||
Check out the <a href="/guides/nwaku/config-options">Node Configuration Options</a> guide for available node configuration options, their default values and descriptions. For examples of common configuration use cases, visit the <a href="/guides/nwaku/configure-nwaku">Node Configuration Examples</a> guide.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="What peer discovery mechanisms are available for nwaku nodes, and how can I configure them?">
|
||||
You can configure peer discovery for nwaku nodes through options like <a href="/learn/concepts/static-peers">Static Peers</a>, <a href="/learn/concepts/dns-discovery">DNS Discovery</a>, <a href="/learn/concepts/discv5">DiscV5</a>, and <a href="/learn/concepts/peer-exchange">Peer Exchange</a>. Check out the <a href="/guides/nwaku/configure-discovery">Configure Peer Discovery</a> guide for setting up your node.
|
||||
</AccordionItem>
|
||||
|
||||
<AccordionItem title="How do I find my nwaku node's addresses for peer discovery?">
|
||||
The node listening and ENR addresses can be found through the node's logs and <a href="https://waku-org.github.io/waku-rest-api/#get-/debug/v1/info">REST API</a>. Check out the <a href="/guides/nwaku/run-node#find-the-node-addresses">Find the node addresses</a> section to understand how to locate your node addresses.
|
||||
</AccordionItem>
|
|
@ -8,7 +8,7 @@ Nwaku is a lightweight and robust Nim client for running a Waku node, equipped w
|
|||
This guide provides detailed steps to download, build, configure, and connect a `nwaku` node to the Waku Network. It also includes interacting with the node and finding its addresses.
|
||||
|
||||
:::info
|
||||
We recommend running a `nwaku` node with at least 2GB of RAM, especially if you have `WSS` enabled. If running just a `Relay` node, 0.5GB of RAM is sufficient.
|
||||
We recommend running a `nwaku` node with at least 2GB of RAM, especially if `WSS` is enabled. If running just a `Relay` node, 0.5GB of RAM is sufficient.
|
||||
:::
|
||||
|
||||
## Get the node binary
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@acid-info/docusaurus-fathom": "^1.0.0-alpha.111",
|
||||
"@acid-info/logos-docusaurus-preset": "^1.0.0-alpha.122",
|
||||
"@acid-info/logos-docusaurus-preset": "^1.0.0-alpha.143",
|
||||
"@docusaurus/core": "^2.4.1",
|
||||
"@docusaurus/preset-classic": "^2.4.1",
|
||||
"@docusaurus/theme-mermaid": "^2.4.1",
|
||||
|
|
|
@ -16,9 +16,10 @@ const sidebars = {
|
|||
"guides/nwaku/run-docker",
|
||||
"guides/nwaku/build-source",
|
||||
"guides/nwaku/configure-discovery",
|
||||
"guides/nwaku/configure-nwaku",
|
||||
"guides/nwaku/config-methods",
|
||||
"guides/nwaku/config-options",
|
||||
"guides/nwaku/configure-nwaku",
|
||||
"guides/nwaku/faq",
|
||||
{
|
||||
type: 'html',
|
||||
value: '<a href="https://waku-org.github.io/waku-rest-api/" target="_blank" rel="noopener noreferrer" class="menu__link external-link">REST API Reference<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.1918 4H3.42848V2.85715H13.1428V12.5714H11.9999V4.80813L3.83254 12.9755L3.02441 12.1674L11.1918 4Z" fill="white"/></svg>',
|
||||
|
@ -42,6 +43,7 @@ const sidebars = {
|
|||
"guides/js-waku/run-waku-nodejs",
|
||||
"guides/js-waku/debug-waku-dapp",
|
||||
"guides/js-waku/manage-filter",
|
||||
"guides/js-waku/faq",
|
||||
{
|
||||
type: 'html',
|
||||
value: '<a href="https://examples.waku.org" target="_blank" rel="noopener noreferrer" class="menu__link external-link">@waku/sdk Examples<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.1918 4H3.42848V2.85715H13.1428V12.5714H11.9999V4.80813L3.83254 12.9755L3.02441 12.1674L11.1918 4Z" fill="white"/></svg>',
|
||||
|
|
40
yarn.lock
40
yarn.lock
|
@ -19,10 +19,10 @@
|
|||
satori "^0.10.1"
|
||||
sharp "^0.32.1"
|
||||
|
||||
"@acid-info/docusaurus-og@^1.0.0-alpha.111":
|
||||
version "1.0.0-alpha.111"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/docusaurus-og/-/docusaurus-og-1.0.0-alpha.111.tgz#0a5f96512f5ad1bf22d632009fe5902b184fb53c"
|
||||
integrity sha512-LrKfnxdG6P0/YtHP2ugz3QMhFCgavfnWLjpuvdlAUA1CWXBDVX33UGvKh4Zt7m5j3tLtpdlEt3Xa3IMgBUJAUg==
|
||||
"@acid-info/docusaurus-og@^1.0.0-alpha.131":
|
||||
version "1.0.0-alpha.131"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/docusaurus-og/-/docusaurus-og-1.0.0-alpha.131.tgz#316a736455c3c0e542b32ad63f1b34714588b67b"
|
||||
integrity sha512-a0EbvwffHdShC8+bDzLA3VqPW71n2NPy01t0c2Tm8lMu1Xo/JOUEAr23qcuRETfOPbiHWY2DJC/3AGWOffc59g==
|
||||
dependencies:
|
||||
"@docusaurus/core" "^2.4.1"
|
||||
"@docusaurus/module-type-aliases" "^2.4.1"
|
||||
|
@ -36,14 +36,14 @@
|
|||
satori "^0.10.1"
|
||||
sharp "^0.32.1"
|
||||
|
||||
"@acid-info/logos-docusaurus-preset@^1.0.0-alpha.122":
|
||||
version "1.0.0-alpha.122"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/logos-docusaurus-preset/-/logos-docusaurus-preset-1.0.0-alpha.122.tgz#17413393d9c7a77db5faf4b9333a8760446feebc"
|
||||
integrity sha512-evBg2XFiU8/F8B78mIA/Ii1oP0zSKZ2qn1eMgx+4t8fyDr0w8VyqCBSInWmWjYkkzOrAEQWDrL0ZxNp/Ct47KA==
|
||||
"@acid-info/logos-docusaurus-preset@^1.0.0-alpha.143":
|
||||
version "1.0.0-alpha.143"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/logos-docusaurus-preset/-/logos-docusaurus-preset-1.0.0-alpha.143.tgz#492a2765da4cf41ec94c0283cba1f722f03012c9"
|
||||
integrity sha512-LsTurD30hmgdylR3scOPvkBck0H9mCOG8JSmKSzFBrHtqeNKgImcZh13HiDFFAOwv8nWk7vci+cmSfaXXd8AqQ==
|
||||
dependencies:
|
||||
"@acid-info/docusaurus-og" "^1.0.0-alpha.111"
|
||||
"@acid-info/docusaurus-og" "^1.0.0-alpha.131"
|
||||
"@acid-info/logos-docusaurus-search-local" "^1.0.0-alpha.111"
|
||||
"@acid-info/logos-docusaurus-theme" "^1.0.0-alpha.122"
|
||||
"@acid-info/logos-docusaurus-theme" "^1.0.0-alpha.143"
|
||||
"@docusaurus/core" "^2.4.1"
|
||||
"@docusaurus/module-type-aliases" "^2.4.1"
|
||||
"@docusaurus/preset-classic" "^2.4.1"
|
||||
|
@ -71,13 +71,13 @@
|
|||
"@easyops-cn/docusaurus-search-local" "^0.33.6"
|
||||
lodash "^4.17.21"
|
||||
|
||||
"@acid-info/logos-docusaurus-theme@^1.0.0-alpha.122":
|
||||
version "1.0.0-alpha.122"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/logos-docusaurus-theme/-/logos-docusaurus-theme-1.0.0-alpha.122.tgz#4da98bf673acb11ebcaad685d8b1cab5f634b26f"
|
||||
integrity sha512-0GKEb94cObPzgfuH21X7MNro7j/zSisI+/7710VMOyidoI9W2OSfe7KwCuIQbW7Y9N+oyw+2YLYKu69RfiLbZg==
|
||||
"@acid-info/logos-docusaurus-theme@^1.0.0-alpha.143":
|
||||
version "1.0.0-alpha.143"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/logos-docusaurus-theme/-/logos-docusaurus-theme-1.0.0-alpha.143.tgz#5f93b13f623fcf789498aa218675ff1ce3196d67"
|
||||
integrity sha512-KOX65g9/bjsaCmz1jThPCUHcyaQBUT0dgViw5TJXCYA6bmaVIZujlNQsJpffH3n6bJCxmgjb3sW1eonwvsgngQ==
|
||||
dependencies:
|
||||
"@acid-info/docusaurus-og" "^1.0.0-alpha.111"
|
||||
"@acid-info/lsd-react" "^0.1.0-alpha.21"
|
||||
"@acid-info/docusaurus-og" "^1.0.0-alpha.131"
|
||||
"@acid-info/lsd-react" "^0.1.0-beta.1"
|
||||
"@docusaurus/core" "^2.4.1"
|
||||
"@docusaurus/mdx-loader" "^2.4.1"
|
||||
"@docusaurus/module-type-aliases" "^2.4.1"
|
||||
|
@ -118,10 +118,10 @@
|
|||
three-stdlib "^2.23.4"
|
||||
utility-types "^3.10.0"
|
||||
|
||||
"@acid-info/lsd-react@^0.1.0-alpha.21":
|
||||
version "0.1.0-alpha.21"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/lsd-react/-/lsd-react-0.1.0-alpha.21.tgz#3a6a6862bc492521197ef354795f1b1fe9bceffe"
|
||||
integrity sha512-zgec9ezT469HBB/rKFzqbgEFiH59Raf8BkWE4XWP4mS9qc2ZQwwYy59TjbJKN5kgwWVnVX/cY1Ryvj9uFcnO8g==
|
||||
"@acid-info/lsd-react@^0.1.0-beta.1":
|
||||
version "0.1.0-beta.3"
|
||||
resolved "https://registry.yarnpkg.com/@acid-info/lsd-react/-/lsd-react-0.1.0-beta.3.tgz#2f211b647d68d6fce163afb60989494f555354be"
|
||||
integrity sha512-lD/x1BZyYdQCUmtMH3YpKSInEO73wRFRxUM6lzbz5UDDUnPfDpj/g4mQrXKL1keV3ujGJbMLaCC36cZT8VgNNw==
|
||||
dependencies:
|
||||
"@datepicker-react/hooks" "^2.8.4"
|
||||
"@emotion/react" "^11.10.5"
|
||||
|
|
Loading…
Reference in New Issue