Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation guide prepared by me.. #80

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 61 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,83 @@
# nwaku-compose

Ready to use docker-compose to run your own [nwaku](https://github.com/waku-org/nwaku) full node:
* nwaku node running relay and store protocols with RLN enabled.
* 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`.
<h1 align="center"> Waku Setup</h1>

# Update Server Packages
```console
sudo apt update && sudo apt upgrade -y
sudo apt-get install build-essential git libpq5 jq -y
```

**📝 0. Prerequisites**

You need:
* Ethereum Sepolia WebSocket endpoint. Get one free from [Infura](https://www.infura.io/).
* 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.

`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.

# After entering the code, we press the 1 key
```console
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
```
cp .env.example .env
${EDITOR} .env
```console
sudo apt install docker.io -y
sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```
# waku for installation

Make sure to **NOT** place any secrets into `.env.example`, as they might be unintentionally published in the Git repository.


**🔑 1. Register RLN membership**

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.
> waku clone
```console
git clone https://github.com/waku-org/nwaku-compose
cd nwaku-compose
cp .env.example .env
```
# .env for change in
> nano .env
```

> These are the parts we will change:
```console
* `ETH_CLIENT_ADDRESS` = I bought Sepolia RPC from Infura and added it for free - https://www.infura.io/
* `ETH_TESTNET_KEY` = We add the metamask private key that I opened for Waku - in the Metamask account information section
* `RLN_RELAY_CRED_PASSWORD` = I set a password
```
> CTRL X Y ENTER We save and exit with .

```console
# Let's register.
./register_rln.sh
# Must have Sepolia eth in wallet before registering
```

**🖥️ 2. Start your node**
<h1 align="center"> Waku node initialization </h1>

Start all processes: nwaku node, database and grafana for metrics. Your RLN membership is loaded into nwaku under the hood.
```console
docker-compose up -d
# We activate the ports in the firewall.

# Let's say yes after entering the following command
sudo ufw enable
sudo ufw allow 22
sudo ufw allow 3000
sudo ufw allow 8545
sudo ufw allow 8645
sudo ufw allow 9005
sudo ufw allow 30304
sudo ufw allow 8645

# Let's get the dockers up
> docker-compose up -d
# let's check dockers
> docker-compose ps
```
# Let's get into it with this command:

**🏄🏼‍♂️ 3. Interact with your nwaku node**
* See [http://localhost:3000/d/yns_4vFVk/nwaku-monitoring](http://localhost:3000/d/yns_4vFVk/nwaku-monitoring) for node metrics.
* See [localhost:4000](http://localhost:4000). Under development 🚧
nano ~/nwaku-compose/docker-compose.yml
```console
> Once inside, let's look at port '3000:3000' by pressing 'ctrl w'.
> `If it says `127.0.0.1:3000:3000`, let's correct it as `0.0.0.0:3000:3000` and write docker-compose down-up.
```

**📬 4. Use the REST API**
> Your data will be updated in approximately 30 minutes.

Your nwaku node exposes a [REST API](https://waku-org.github.io/waku-rest-api/) to interact with it.
> `http://IP_ADRESS:3000/d/ReginaMeis/nwaku-monitoring`

```
# 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
```
> Open your IP ADDRESS from the browser with the IP of your own server.

**Publish a message to a `contentTopic`**. Everyone subscribed to it will receive it. Note that `payload` is base64 encoded.
> Save the `keystore.json` file for backup.

```
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"}'
```

**Get messages sent to a `contentTopic`**. Note that any store node in the network is used to reply.
```
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"
```

For advanced documentation, refer to [ADVANCED.md](https://github.com/waku-org/nwaku-compose/blob/master/ADVANCED.md).