From 8e4a33b0a0f2a91026001fab0aed97478024bfed Mon Sep 17 00:00:00 2001 From: Tanya S <120410716+stubbsta@users.noreply.github.com> Date: Tue, 29 Jul 2025 02:37:45 +0200 Subject: [PATCH] Update default config for relay without publishing (#169) Co-authored-by: fryorcraken --- .env.example | 14 -------------- .env.example.rln | 19 +++++++++++++++++++ README.md | 34 +++++++++------------------------- docker-compose.yml | 19 ++++++++++--------- run_node.sh | 20 ++++++++++++++------ 5 files changed, 52 insertions(+), 54 deletions(-) create mode 100644 .env.example.rln diff --git a/.env.example b/.env.example index e0fbd74..785cc32 100644 --- a/.env.example +++ b/.env.example @@ -2,23 +2,9 @@ # e.g. https://linea-sepolia.infura.io/v3/123aa110320f4aec179150fba1e1b1b1 RLN_RELAY_ETH_CLIENT_ADDRESS=https://linea-sepolia.infura.io/v3/ -# Account of testnet where you have Linea Sepolia ETH that would be staked into RLN contract. -# e.g.: ETH_TESTNET_ACCOUNT=0xbecd1546a397a6bad875247d51c4c6da0e469021 -ETH_TESTNET_ACCOUNT= - -# Private key of testnet where you have Linea Sepolia ETH that would be staked into RLN contract. -# 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= - # Address of the RLN contract on Linea Sepolia. RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6 -# Address of the RLN Membership Token contract on Linea Sepolia used to pay for membership. -TOKEN_CONTRACT_ADDRESS=0x185A0015aC462a0aECb81beCc0497b649a64B9ea -# 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= diff --git a/.env.example.rln b/.env.example.rln new file mode 100644 index 0000000..a9c71e5 --- /dev/null +++ b/.env.example.rln @@ -0,0 +1,19 @@ +## RLN Credentials - EXPERIMENTAL +## If you have/want an RLN membership to send messages + +# Account of testnet where you have Linea Sepolia ETH that would be staked into RLN contract. +# e.g.: ETH_TESTNET_ACCOUNT=0xbecd1546a397a6bad875247d51c4c6da0e469021 +ETH_TESTNET_ACCOUNT= + +# Address of the RLN Membership Token contract on Linea Sepolia used to pay for membership. +TOKEN_CONTRACT_ADDRESS=0x185A0015aC462a0aECb81beCc0497b649a64B9ea + +# Private key of testnet where you have Linea Sepolia ETH that would be staked into RLN contract. +# 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= + +# Path and password to the keystore file +RLN_RELAY_CRED_PATH= +RLN_RELAY_CRED_PASSWORD= \ No newline at end of file diff --git a/README.md b/README.md index 05a56b4..ad77050 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,33 @@ # nwaku-compose -Ready‑to‑use **docker‑compose** stack for running your own [nwaku](https://github.com/waku-org/nwaku) full node: +Ready‑to‑use **docker‑compose** stack for running your own [nwaku](https://github.com/waku-org/nwaku) node: -* RLN‑enabled nwaku node (relay + store protocols) -* Simple web UI to publish and receive messages +* RLN‑enabled nwaku node (relay + store protocols, excluding message publishing) * Grafana dashboard for metrics * Requires **Docker Compose** and **Git** ## 📝 Prerequisites * **Linea Sepolia RPC endpoint** — grab one for free on [Infura](https://www.infura.io) -* **Linea Sepolia wallet** with at least **0.01 ETH** +* **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) ### 🚀 Starting your node -| # | Option | Quick-start command | What happens | -|---|------|--------------------|--------------| -| **1** | **script** | Power user / CI | setup a .env file manually, run ./register_rln.sh, and then start the node.| -| **2** | **setup-wizard** | Fastest one-command bootstrap | Generates `.env`, registers RLN, and spins up the whole stack automatically | +| # | 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 |
-🧪 option 1 :- SCRIPT [ manual ] [ recommended ] +🧪 option A :- SCRIPT [ manual ] [ recommended ] ``` cp .env.example .env ``` Edit the .env file and fill in all required parameters -This command will register your membership and store it in `keystore/keystore.json`: -``` -./register_rln.sh -``` ### 💽 2. Select DB Parameters @@ -73,7 +68,6 @@ docker-compose up -d ###🏄🏼‍♂️ 4. Interact with your nwaku node * 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. **📬 4. Use the REST API** @@ -86,14 +80,6 @@ curl http://127.0.0.1:8645/debug/v1/version curl http://127.0.0.1:8645/debug/v1/info ``` -**Publish a message to a `contentTopic`**. Everyone subscribed to it will receive it. Note that `payload` is base64 encoded. - -``` -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" \ @@ -105,7 +91,7 @@ For advanced documentation, refer to [ADVANCED.md](https://github.com/waku-org/n
-⚙️ option 2 :- SETUP-WIZARD [ experimental ] +⚙️ option B (not recommended at this time):- SETUP-WIZARD [ experimental ] Run the wizard script. Once the script is done, the node will be started for you, so there is nothing else to do. @@ -123,8 +109,6 @@ RLN membership is your access key to The Waku Network. It is registered on-chain If you just want to relay traffic (not publish), you don't need to perform the registration. - - -----
How to update to latest version diff --git a/docker-compose.yml b/docker-compose.yml index ca93908..5eab3f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -143,16 +143,17 @@ services: depends_on: - postgres - waku-frontend: - # TODO: migrate to waku-org - image: alrevuelta/waku-frontend:aad9628 - ports: - - 127.0.0.1:4000:4000 - restart: on-failure:5 - depends_on: - - nwaku +## Uncomment if you have RLN credentials and want to use play with a front end to send messages +# waku-frontend: +# # TODO: migrate to waku-org +# image: alrevuelta/waku-frontend:aad9628 +# ports: +# - 127.0.0.1:4000:4000 +# restart: on-failure:5 +# depends_on: +# - nwaku -## Remove comment if you need pgadmin support in your container. +## Uncomment if you need pgadmin support in your container. ## Commented for backward version compatibility of docker-compose. # pgadmin: # image: dpage/pgadmin4:latest diff --git a/run_node.sh b/run_node.sh index 9048e1f..063e02a 100755 --- a/run_node.sh +++ b/run_node.sh @@ -87,13 +87,21 @@ if [ -n "${NODEKEY}" ]; then NODEKEY=--nodekey=${NODEKEY} fi -RLN_RELAY_CRED_PATH=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH:-/keystore/keystore.json} - - if [ -n "${RLN_RELAY_CRED_PASSWORD}" ]; then RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password="${RLN_RELAY_CRED_PASSWORD}" + ## Enable Light Push (RLNaaS) if RLN credentials are used + LIGHTPUSH=--lightpush=true + ## Pass default value for credentials path if not set + RLN_RELAY_CRED_PATH=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH:-/keystore/keystore.json} + echo "Using RLN credentials from ${RLN_RELAY_CRED_PATH}" +else + LIGHTPUSH=--lightpush=false + # Ensure no empty values are passed + RLN_RELAY_CRED_PATH="" + RLN_RELAY_CRED_PASSWORD="" fi + STORE_RETENTION_POLICY=--store-message-retention-policy=size:1GB if [ -n "${STORAGE_SIZE}" ]; then @@ -103,7 +111,7 @@ fi exec /usr/bin/wakunode\ --relay=true\ --filter=true\ - --lightpush=true\ + ${LIGHTPUSH}\ --keep-alive=true\ --max-connections=150\ --cluster-id=1\ @@ -126,8 +134,8 @@ exec /usr/bin/wakunode\ --store-message-db-url="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/postgres"\ --rln-relay-eth-client-address="${RLN_RELAY_ETH_CLIENT_ADDRESS}"\ --rln-relay-tree-path="/etc/rln_tree"\ - "${RLN_RELAY_CRED_PATH}"\ - "${RLN_RELAY_CRED_PASSWORD}"\ + ${RLN_RELAY_CRED_PATH}\ + ${RLN_RELAY_CRED_PASSWORD}\ ${DNS_WSS_CMD}\ ${NODEKEY}\ ${STORE_RETENTION_POLICY}\