diff --git a/docs/guides/nwaku/run-docker-compose.md b/docs/guides/nwaku/run-docker-compose.md index 01975c7..9394706 100644 --- a/docs/guides/nwaku/run-docker-compose.md +++ b/docs/guides/nwaku/run-docker-compose.md @@ -2,15 +2,21 @@ title: Run Nwaku with Docker Compose --- -`nwaku-compose` is a ready-to-use Docker Compose setup that runs a nwaku node and monitors it with already configured [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/) instances. +`nwaku-compose` is a ready-to-use Docker Compose setup that runs the following: -This guide provides detailed steps to build, configure, run, and monitor a `nwaku` node with [nwaku-compose](https://github.com/waku-org/nwaku-compose). +- `nwaku` node running [Relay](/overview/concepts/protocols#relay) and [Store](/overview/concepts/protocols#store) protocols with [RLN](/overview/concepts/protocols#rln-relay) enabled. +- Simple frontend to interact with your node and the network to send and receive messages. +- [Grafana](https://grafana.com/) metrics dashboard for advanced users or node operators. + +This guide provides detailed steps to configure, run, monitor, and interact with a `nwaku` node with [nwaku-compose](https://github.com/waku-org/nwaku-compose). ## Prerequisites - [Git](https://git-scm.com/) or [GitHub Desktop](https://desktop.github.com/) -- [Docker](https://docs.docker.com/engine/install/) -- [Docker Compose](https://docs.docker.com/compose/install/) +- [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/) +- [Ethereum Sepolia WebSocket Endpoint](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#3-access-a-node-on-the-sepolia-testnet-using-infura) +- [Wallet with Sepolia Ethereum](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#2-obtain-sepolia-eth-from-faucet) (less than 0.1 Sepolia ETH) +- A password to protect your RLN membership ## Clone the Repository @@ -21,19 +27,37 @@ cd nwaku-compose ## Configure the Setup -Modify the `run_node.sh` file to customise your [node's configuration](/guides/reference/node-config-options) and `docker-compose.yml` to specify particular [Docker image](https://hub.docker.com/r/statusteam/nim-waku/tags) tag. +Modify the `run_node.sh` file to customise your [node's configuration](/guides/reference/node-config-options) and `docker-compose.yml` to specify particular [Docker image](https://hub.docker.com/r/statusteam/nim-waku/tags) tag. Next, export your Ethereum Sepolia configuration and membership password: + +```shell +export ETH_CLIENT_ADDRESS=wss://sepolia.infura.io/ws/v3/[INFURA API KEY] +export ETH_TESTNET_KEY=[INFURA API KEY] +export KEYSTORE_PASSWORD=[RLN MEMBERSHIP PASSWORD] +``` + +## Register RLN Membership + +The RLN membership is your access key to The Waku Network. Its registration is done on-chain and allows your `nwaku` node to send messages decentralised and privately, respecting some rate limits. Other peers won't relay messages exceeding the rate limit: + +```shell +./register_rln.sh +``` + +:::info +If you only want to relay traffic without sending messages to the network, you don't need to register for RLN membership. +::: ## Run Docker Compose -Spin up the containers using `docker-compose`: +Start all processes: `nwaku` node, database and Grafana for metrics. Your RLN membership is loaded into nwaku under the hood: ```bash docker-compose up -d ``` -## Monitor the Node +## Interact with the Node -Visit to view your node metrics in real-time. +Visit to view your node metrics in real-time. ![nwaku compose dashboard](/img/nwaku-compose-dashboard.png) @@ -41,6 +65,33 @@ Visit to view your To access Grafana from outside your machine, remove `127.0.0.1` and open the port. Consider setting up a password for Grafana to ensure security. ::: +## Use the REST API + +Your `nwaku` node provides a [REST API](https://waku-org.github.io/waku-rest-api/) on port `8645` for interacting with it: + +```shell +# Get nwaku version +curl http://127.0.0.1:8645/debug/v1/version + +# Get nwaku info +curl http://127.0.0.1:8645/debug/v1/info +``` + +Send a message to a `contentTopic`, which all subscribers will receive. Please note that the payload is encoded in `base64`. + +```shell +curl -X POST "http://127.0.0.1:8645/relay/v1/auto/messages" \ + -H "content-type: application/json" \ + -d '{"payload":"'$(echo -n "Hello Waku Network - from Anonymous User" | base64)'","contentTopic":"/my-app/2/chatroom-1/proto"}' +``` + +Retrieve messages sent to a `contentTopic`. Please note that this query can be made to any `Store` node within the network: + +```shell +curl -X GET "http://127.0.0.1:8645/store/v1/messages?contentTopics=%2Fmy-app%2F2%2Fchatroom-1%2Fproto&pageSize=50&ascending=true" \ + -H "accept: application/json" +``` + :::tip Congratulations! -You have successfully started a `nwaku` node using Docker Compose. Have a look at the [Nwaku Configuration Examples](/guides/nwaku/configure-nwaku) guide to learn how to configure `nwaku` for different use cases. +You have successfully started a `nwaku` node with `RLN` enabled using Docker Compose. Have a look at the [Nwaku Configuration Examples](/guides/nwaku/configure-nwaku) and [Advanced Configuration](https://github.com/waku-org/nwaku-compose/blob/master/ADVANCED.md) guides to learn how to configure `nwaku` for different use cases. ::: \ No newline at end of file diff --git a/docs/overview/waku-network.md b/docs/overview/waku-network.md index 6f9e0c7..a08e596 100644 --- a/docs/overview/waku-network.md +++ b/docs/overview/waku-network.md @@ -23,8 +23,8 @@ If you want to learn more about the Waku Network, the [WAKU2-NETWORK RFC](https: ## Prerequisites -1. **Ethereum Sepolia node**, which can be yours or from a third party. Have a look at the [Access a Sepolia Node Using Infura](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#3-access-a-node-on-the-sepolia-testnet-using-infura) guide for a free Infura option. This node is used to interact with the [on-chain RLN membership contract](https://rfc.vac.dev/spec/17/). -2. **Wallet with Sepolia ETH** (less than 0.1 Sepolia ETH). Have a look at the [Create a Sepolia Ethereum Wallet](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#1-create-a-sepolia-ethereum-account-and-obtain-its-private-key) and [Obtain Sepolia ETH from Faucet](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#2-obtain-sepolia-eth-from-faucet) guides to get a Sepolia wallet and fund it with some Sepolia ETH. This wallet is required to register [RLN membership](https://rfc.vac.dev/spec/17/#setup-and-registration), which is essential for publishing on the network. +1. **Ethereum Sepolia WebSocket Endpoint**, which can be yours or from a third party. Have a look at the [Access a Sepolia Node Using Infura](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#3-access-a-node-on-the-sepolia-testnet-using-infura) guide for a free Infura option. This node is used to interact with the [on-chain RLN membership contract](https://rfc.vac.dev/spec/17/). +2. **Wallet with Sepolia Ethereum** (less than 0.1 Sepolia ETH). Have a look at the [Create a Sepolia Ethereum Wallet](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#1-create-a-sepolia-ethereum-account-and-obtain-its-private-key) and [Obtain Sepolia Ethereum from Faucet](https://github.com/waku-org/nwaku/blob/master/docs/tutorial/pre-requisites-of-running-on-chain-spam-protected-chat2.md#2-obtain-sepolia-eth-from-faucet) guides to get a Sepolia wallet and fund it with some Sepolia Ethereum. This wallet is required to register [RLN membership](https://rfc.vac.dev/spec/17/#setup-and-registration), which is essential for publishing on the network. ## Running a Waku Network Node