2023-08-09 10:36:03 +00:00
# nwaku-compose
2023-11-07 18:01:28 +00:00
Ready to use docker-compose to run your own [nwaku ](https://github.com/waku-org/nwaku ) full node:
2023-11-01 15:45:46 +00:00
* nwaku node running relay and store protocols with RLN enabled.
2023-11-01 15:51:30 +00:00
* Simple frontend to interact with your node and the network, to publish and receive messages.
* Grafana dashboard for advanced users or node operators.
* Requires `docker-compose` and `git` .
2023-08-09 10:36:03 +00:00
2023-11-07 18:01:28 +00:00
**📝 0. Prerequisites**
You need:
2024-07-30 07:40:05 +00:00
* Ethereum Sepolia HTTP endpoint. Get one free from [Infura ](https://www.infura.io/ ).
2023-11-07 18:01:28 +00:00
* Ethereum Sepolia account with some balance < 0.01 Eth . Get some [here ](https://www.infura.io/faucet/sepolia ).
* A password to protect your rln membership.
2024-02-01 20:03:49 +00:00
`docker-compose` [will read the `./.env` file ](https://docs.docker.com/compose/environment-variables/set-environment-variables/#additional-information-3 ) from the filesystem. There is `.env.example` available for you as a template to use for providing the above values. The process when working with `.env` files is to copy the `.env.example` , store it as `.env` and edit the values there.
2023-11-13 11:58:23 +00:00
```
cp .env.example .env
2023-11-13 15:06:39 +00:00
${EDITOR} .env
2023-11-13 11:58:23 +00:00
```
2023-11-13 15:06:39 +00:00
Make sure to **NOT** place any secrets into `.env.example` , as they might be unintentionally published in the Git repository.
2024-02-01 20:03:49 +00:00
2023-11-07 18:01:28 +00:00
**🔑 1. Register RLN membership**
2023-11-10 07:56:34 +00:00
The RLN membership is your access key to The Waku Network. Its registration is done onchain, and allows your nwaku node to publish messages in a decentralized and private way, respecting some [rate limits ](https://rfc.vac.dev/spec/64/#rate-limit-exceeded ).
Messages exceeding the rate limit won't be relayed by other peers.
This command will register your membership and store it in `keystore/keystore.json` .
Note that if you just want to relay traffic (not publish), you don't need one.
2023-11-07 18:01:28 +00:00
2023-11-01 15:45:46 +00:00
```
2023-11-07 18:01:28 +00:00
./register_rln.sh
2023-08-09 10:36:03 +00:00
```
2023-11-07 18:16:07 +00:00
**🖥️ 2. Start your node**
2023-11-07 18:01:28 +00:00
2024-03-14 09:06:08 +00:00
Start all processes: nwaku node, database and grafana for metrics. Your [RLN ](https://rate-limiting-nullifier.github.io/rln-docs/what_is_rln.html ) membership is loaded into nwaku under the hood.
2023-10-03 12:34:52 +00:00
```console
2023-11-01 15:45:46 +00:00
docker-compose up -d
2023-10-03 12:34:52 +00:00
```
2024-03-14 09:06:08 +00:00
⚠️ The node might take ~5' the very first time it runs because it needs to build locally the RLN community membership tree.
2023-10-03 12:34:52 +00:00
2023-11-07 18:01:28 +00:00
**🏄🏼♂️ 3. Interact with your nwaku node**
2024-07-03 16:35:45 +00:00
* See [localhost:3000 ](http://localhost:3000/d/yns_4vFVk/nwaku-monitoring ) for node metrics.
* See [localhost:4000 ](http://localhost:4000 ) for a nice frontend to chat with other users.
2023-11-07 18:01:28 +00:00
2024-07-03 16:35:45 +00:00
**📬 4. Use the REST API**
2023-11-07 18:01:28 +00:00
Your nwaku node exposes a [REST API ](https://waku-org.github.io/waku-rest-api/ ) to interact with it.
2023-10-03 12:34:52 +00:00
2023-11-07 18:01:28 +00:00
```
# 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
```
2023-11-07 18:14:56 +00:00
**Publish a message to a `contentTopic` **. Everyone subscribed to it will receive it. Note that `payload` is base64 encoded.
2023-11-07 18:01:28 +00:00
```
curl -X POST "http://127.0.0.1:8645/relay/v1/auto/messages" \
-H "content-type: application/json" \
2024-03-04 23:19:52 +00:00
-d '{"payload":"'$(echo -n "Hello Waku Network - from Anonymous User" | base64)'","contentTopic":"/my-app/2/chatroom-1/proto"}'
2023-11-07 18:01:28 +00:00
```
2023-11-07 18:14:56 +00:00
**Get messages sent to a `contentTopic` **. Note that any store node in the network is used to reply.
2023-11-07 18:01:28 +00:00
```
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"
```
2023-10-03 12:34:52 +00:00
2023-11-09 15:18:53 +00:00
For advanced documentation, refer to [ADVANCED.md ](https://github.com/waku-org/nwaku-compose/blob/master/ADVANCED.md ).
2024-07-26 17:42:31 +00:00
-----
# How to update to latest version
2024-07-29 09:07:38 +00:00
We regularly announce new available versions in our [Discord ](https://discord.waku.org/ ) server.
2024-07-26 17:42:31 +00:00
2024-08-02 07:42:59 +00:00
If your last running version is `v0.29` or older, you will need to delete both the `keystore` and `rln_tree` folders, and register your membership again before using the new version by running the following commands:
2024-08-28 13:41:04 +00:00
1. `cd nwaku-compose` ( go into the root's repository folder )
2. `docker-compose down`
3. `sudo rm -r keystore rln_tree`
4. `git pull origin master`
5. `./register_rln.sh`
6. `docker-compose up -d`
2024-08-02 07:42:59 +00:00
For nodes running on `v0.30` or newer, updating the node is as simple as running the following:
2024-08-28 13:41:04 +00:00
1. `cd nwaku-compose` ( go into the root's repository folder )
2. `docker-compose down`
3. `git pull origin master`
4. `docker-compose up -d`