fix: update readme.md and wizard (#171)

This commit is contained in:
Darshan K 2025-08-13 11:44:00 +05:30 committed by GitHub
parent 758a30a1d0
commit 1efe84e72b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 88 additions and 179 deletions

View File

@ -3,6 +3,7 @@
# Enter your own RPC URL
RLN_RELAY_ETH_CLIENT_ADDRESS=https://linea-sepolia.infura.io/v3/<key>
# Address of the RLN contract on Linea Sepolia.
# DO NOT TOUCH unless you know what you are doing
RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6

131
README.md
View File

@ -1,97 +1,50 @@
# nwaku-compose
Readytouse **dockercompose** stack for running your own [nwaku](https://github.com/waku-org/nwaku) node:
* RLNenabled nwaku node (relay + store protocols, excluding message publishing)
* Grafana dashboard for metrics
* Requires **Docker Compose** and **Git**
Readytouse **docker compose** stack for running your own [nwaku](https://github.com/waku-org/nwaku) node.
## 📝 Prerequisites
* **Linea Sepolia RPC endpoint** — grab one for free on [Infura](https://www.infura.io)
* **Linea Sepolia wallet** with at least **0.01 ETH** (Only Required For RLN Membership Registration which is WIP)
* Need test ETH? Use the [Linea Sepolia faucet](https://www.infura.io/faucet/sepolia)
* Already have ETH on Sepolia? Bridge it to Linea via the [official bridge](https://bridge.linea.build/native-bridge)
- **Docker** and **Git**
- **Linea Sepolia RPC endpoint** You can get a free endpoint from [Infura](https://www.infura.io) or any other Linea Sepolia RPC provider.
### 🚀 Starting your node
| # | Option | Quick-start command | What happens |
|-------|----------------------|-------------------------------|-----------------------------------------------------------------------------|
| **A** | **script** | Power user / CI | setup a .env file manually and then start the node. |
| **B** | **WIP setup-wizard** | Fastest one-command bootstrap | Generates `.env`, registers RLN, and spins up the whole stack automatically |
| # | Setup Type | Setup Style | What happens |
|-------|---------------------|----------------------|-----------------------------------------------------------------------------|
| **A** | **manual** | Power User | Setup a .env file manually and then start the node. |
| **B** | **setup-wizard** | Command-Line | Generates `.env`, starts the node. |
<details>
<summary>🧪 option A :- SCRIPT [ manual ] [ recommended ] </summary>
<summary>🧪 OPTION A :- manual [ recommended ] </summary>
### 1. Setup .env file
```
cp .env.example .env
```
Edit the .env file and fill in all required parameters
### 💽 2. Set Database Parameters
### 💽 2. Select DB Parameters
Waku uses PostgreSQL to store and serve messages.
Limit disk usage and (optionally) increase shared memory for better performance.
Waku runs a PostgreSQL Database to store messages from the network and serve them to other peers.
To prevent the database to grow indefinitely, you need to select how much disk space to allocate.
You can either run a script that will estimate and set a good value:
```
./set_storage_retention.sh
```
Or select your own value. For example, `50GB`:
```shell
echo "STORAGE_SIZE=50GB" >> .env
```
Depending on your machine's memory, it may be worth allocating more memory to the Postgres container to ensure heavy queries are served:
```shell
./set_postgres_shm.sh
```
Or select your own value manually, for example, `4g`:
```shell
echo "POSTGRES_SHM=4g" >> .env
```
| Setting | Auto-set command | Manual example |
|----------------|---------------------------------|--------------------------------------|
| Storage size | `./set_storage_retention.sh` | `echo "STORAGE_SIZE=50GB" >> .env` |
| Shared memory | `./set_postgres_shm.sh` | `echo "POSTGRES_SHM=4g" >> .env` |
### 🖥️ 3. Start your node
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.
```console
docker-compose up -d
```
⚠️ The node might take a few minutes the very first time it runs because it needs to build locally the RLN community membership tree.
###🏄🏼‍♂️ 4. Interact with your nwaku node
* See [localhost:3000](http://localhost:3000/d/yns_4vFVk/nwaku-monitoring) for node metrics.
**📬 4. Use the REST API**
Your nwaku node exposes a [REST API](https://waku-org.github.io/waku-rest-api/) to interact with it.
Start all processes: nwaku node, database and grafana for metrics.
```
# 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
docker compose up -d
```
**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).
</details>
<details>
<summary>⚙️ option B (not recommended at this time):- SETUP-WIZARD [ experimental ]</summary>
<summary>⚙️ OPTION B :- setup-wizard [ experimental ]</summary>
Run the wizard script.
Once the script is done, the node will be started for you, so there is nothing else to do.
@ -104,20 +57,38 @@ The script is experimental, feedback and pull requests are welcome.
</details>
### 🛑 Shutting down your node
To gracefully shut down your node:
```shell
docker compose down
```
### 📌 Note
RLN membership is your access key to The Waku Network. It is registered on-chain, enabling your nwaku node to send messages in a decentralized and privacy-preserving way while adhering to rate limits. Messages exceeding the rate limit will not be relayed by other peers.
If you just want to relay traffic (not publish), you don't need to perform the registration.
-----
<details>
<summary>Monitor your nwaku node </summary>
- **Metrics (Grafana):**
Open [localhost:3000](http://localhost:3000/d/yns_4vFVk/nwaku-monitoring) to view node metrics.
- **Live logs:**
See whats happening inside your node in real time:
```bash
docker compose logs nwaku -f --tail 100
```
- **Use the REST API**
Your nwaku node exposes a [REST API](https://waku-org.github.io/waku-rest-api/) to interact with it.
```
# 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
```
For advanced documentation, refer to [ADVANCED.md](https://waku-org.github.io/waku-rest-api/).
</details>
<details>
<summary>How to update to latest version</summary>
@ -127,7 +98,6 @@ We regularly announce new available versions in our [Discord](https://discord.wa
Please review the latest https://github.com/waku-org/nwaku-compose/blob/master/.env.example env var template file and update your .env accordingly.
Make sure you have some ETH in your Linea Sepolia account.
Also, move your Sepolia RPC client (e.g., Infura) to a Linea Sepolia RPC client.
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:
@ -148,17 +118,6 @@ Updating the node is as simple as running the following:
4. `docker-compose up -d`
</details>
<details>
<summary>Set storage size (optional)</summary>
To improve storage on the network, you can increase the allocated space for the database.
To do so, you can simply run:
```
./set_storage_retention.sh
```
</details>
<details>
<summary>Node's health check</summary>

View File

@ -9,14 +9,25 @@ RLN_RELAY_ETH_CLIENT_ADDRESS=https://linea-sepolia.infura.io/v3/<key>
# e.g.: ETH_TESTNET_ACCOUNT=0xbecd1546a397a6bad875247d51c4c6da0e469021
ETH_TESTNET_ACCOUNT=<YOUR_TESTNET_ACCOUNT_ADDRESS_HERE>
# Address of the RLN Membership Token contract on Linea Sepolia used to pay for membership.
TOKEN_CONTRACT_ADDRESS=0xd17e184e3c1941585a3edcb3a10367da6326d844
# Private key of testnet where you have Linea Sepolia ETH that would be staked into RLN contract.
# Private key of ETH_TESTNET_ACCOUNT.
# Note: make sure you don't use the '0x' prefix.
# Use the following as a format example, but replace it with your own private key value
# e.g. ETH_TESTNET_KEY=abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234
ETH_TESTNET_KEY=<YOUR_TESTNET_PRIVATE_KEY_HERE>
# Address of the RLN contract on Linea Sepolia.
# DO NOT TOUCH unless you know what you are doing
RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6
# Address of the RLN Membership Token contract on Linea Sepolia used to pay for membership.
TOKEN_CONTRACT_ADDRESS=0xd17e184e3c1941585a3edcb3a10367da6326d844
# Password you would like to use to protect your RLN membership.
RLN_RELAY_CRED_PASSWORD="my_secure_keystore_password"
# Advanced. Can be left empty in normal use cases.
NWAKU_IMAGE=
NODEKEY=
DOMAIN=
EXTRA_ARGS=
STORAGE_SIZE=

View File

@ -0,0 +1,23 @@
# Dogfooding
## 📝 Prerequisites
- **Docker** and **Git**
1. Copy `.env.example.publisher` to `.env` and fill in all parameters.
```
cp dogfooding/.env.example.publisher .env
```
2. Obtain test tokens (if needed, request in Discord).
3. Run the RLN registration script:
```
./register_rln.sh
```
4. Start the node:
```
docker compose up -d
```

View File

@ -8,20 +8,7 @@ echocol()
}
RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6
TOKEN_CONTRACT_ADDRESS=0x185A0015aC462a0aECb81beCc0497b649a64B9ea
REQUIRED_AMOUNT=5
check_eth_balance() {
# 0.01 ETH in wei
local MIN=10000000000000000
local BAL
BAL=$(cast balance "$ETH_TESTNET_ACCOUNT" --rpc-url "$RLN_RELAY_ETH_CLIENT_ADDRESS" 2>/dev/null | tr -d '[:space:]')
[ -z "$BAL" ] && { echocol "Couldnt fetch ETH balance."; exit 1; }
[ "$BAL" -lt "$MIN" ] && { echocol "Need ≥ 0.01 Linea Sepolia ETH. Top up at https://www.infura.io/faucet/sepolia"; exit 1; }
echocol "✅ You have enough Linea Sepolia ETH to register."
}
if [ -f ./.env ]; then
echocol ".env file already exists."
@ -35,16 +22,6 @@ if [ -f ./.env ]; then
fi
fi
if [ -f keystore/keystore.json ]; then
echocol "'keystore/keystore.json' already exists."
read -p "Do you want to delete and regenerate it? (y/N): " RECREATE_KEYSTORE
if [ "$RECREATE_KEYSTORE" = "y" ] || [ "$RECREATE_KEYSTORE" = "Y" ]; then
rm -f keystore/keystore.json
echocol "Old keystore/keystore.json removed. Generating a new one..."
else
echocol "Keeping existing keystore/keystore.json. Exiting wizard."
fi
fi
# Ensure Foundry (cast & foundryup) is available for token mint/approve calls
if ! command -v cast >/dev/null 2>&1; then
@ -83,33 +60,6 @@ if [ -z "$RLN_RELAY_ETH_CLIENT_ADDRESS" ] \
exit 1
fi
echocol ""
echocol "Now enter your Linea Sepolia Testnet account address (should start with 0x and be 42 characters)"
read -p "ETH_TESTNET_ACCOUNT: " ETH_TESTNET_ACCOUNT
if ! [[ "$ETH_TESTNET_ACCOUNT" =~ ^0x[0-9a-fA-F]{40}$ ]]; then
echo "Invalid value, received '$ETH_TESTNET_ACCOUNT'"
exit 1
fi
echocol ""
echocol "Checking your Linea Sepolia Testnet balance..."
check_eth_balance
echocol ""
echocol "Now enter your Linea Sepolia Testnet private key in hex format 0a...1f without 0x prefix"
read -p "ETH_TESTNET_KEY: " ETH_TESTNET_KEY
if ! [[ "$ETH_TESTNET_KEY" =~ ^[0-9a-fA-F]{64}$ ]]; then
echo "Invalid value, received '$ETH_TESTNET_KEY'"
exit 1
fi
echocol ""
echocol "Generating a password for the RLN membership keystore file..."
read -p "Press ENTER to continue..." foo
RLN_RELAY_CRED_PASSWORD=$(LC_ALL=C < /dev/urandom tr -dc ',/.;:<>?!@#$%^&*()+\-_A-Z-a-z-0-9' | head -c${1:-16}; echo)
echocol ""
echocol "Estimating storage size for DB..."
read -p "Press ENTER to continue..." foo
@ -136,52 +86,17 @@ echocol "They will be saved to '.env'. Press ENTER to confirm or CONTROL-C to ca
echocol ""
echocol "RLN_RELAY_ETH_CLIENT_ADDRESS: $RLN_RELAY_ETH_CLIENT_ADDRESS"
echocol "ETH_TESTNET_KEY: $ETH_TESTNET_KEY"
echocol "ETH_TESTNET_ACCOUNT: $ETH_TESTNET_ACCOUNT"
echocol "RLN_RELAY_CRED_PASSWORD: $RLN_RELAY_CRED_PASSWORD"
echocol "RLN_CONTRACT_ADDRESS: $RLN_CONTRACT_ADDRESS"
echocol "STORAGE_SIZE: $STORAGE_SIZE"
echocol "POSTGRES_SHM: $POSTGRES_SHM"
read -p "Press ENTER to continue..." foo
echo "RLN_RELAY_ETH_CLIENT_ADDRESS='$RLN_RELAY_ETH_CLIENT_ADDRESS'
ETH_TESTNET_KEY=$ETH_TESTNET_KEY
ETH_TESTNET_ACCOUNT=$ETH_TESTNET_ACCOUNT
RLN_RELAY_CRED_PASSWORD='$RLN_RELAY_CRED_PASSWORD'
RLN_CONTRACT_ADDRESS=$RLN_CONTRACT_ADDRESS
STORAGE_SIZE=$STORAGE_SIZE
POSTGRES_SHM=$POSTGRES_SHM" > ./.env
echocol ""
echocol "Checking your TTT token balance..."
USER_BALANCE_RAW=$(cast call $TOKEN_CONTRACT_ADDRESS "balanceOf(address)(uint256)" $ETH_TESTNET_ACCOUNT --rpc-url $RLN_RELAY_ETH_CLIENT_ADDRESS 2>/dev/null)
USER_BALANCE=$(echo "$USER_BALANCE_RAW" | awk '{print $1}')
USER_BALANCE=$(echo "$USER_BALANCE / 10^18" | bc)
if [ -z "$USER_BALANCE" ]; then
echocol "Could not fetch balance. Please ensure your RPC endpoint and account are correct."
exit 1
fi
echocol "Your current TTT token balance is: $USER_BALANCE"
echocol "Required amount: $REQUIRED_AMOUNT"
echocol ""
MINT_CHOICE="y"
if [ "$USER_BALANCE" -ge "$REQUIRED_AMOUNT" ]; then
echocol "You already have enough TTT tokens to register."
read -p "Do you want to mint more tokens? (y/N): " MINT_CHOICE
fi
if [ "$MINT_CHOICE" = "y" ] || [ "$MINT_CHOICE" = "Y" ]; then
./register_rln.sh --mint;
else
./register_rln.sh --no-mint;
fi
echocol ""
echocol "✅ RLN membership registered successfully!"
echocol ""
echocol "Your node is ready! enter the following command to start it:"
read -p "Press ENTER to continue..." foo
docker-compose up -d