Navigate to nwaku-compose there is .env.example available for you as a template to use for providing the below values.
docker-compose will read the ./.env file from the filesystem. The process when working with .env files is to copy the .env.example, store it as .env and edit the values there by running the following command:
cp .env.example .env
Edit the .env value with your own data
vim .env
Insert the required data
ETH_CLIENT_ADDRESS=wss://sepolia.infura.io/ws/v3/<YOUR_ENDPOINT_KEY_HERE> #RPC URL for accessing testnet via websockets.
ETH_TESTNET_KEY=<YOUR_PRIVATE_KEY_HERE> # Privatekey of testnet where you have sepolia ETH that would be staked into RLN contract (If you can't find one, export private key from your EVM wallet address)
RLN_RELAY_CRED_PASSWORD="<YOUR_CUSTOM_PASSWORD_HERE>" #Password you would like to use to protect your RLN membership
# Advanced (Optional)
NWAKU_IMAGE=
NODEKEY=
DOMAIN=
EXTRA_ARGS=
RLN_RELAY_CONTRACT_ADDRESS=
Register RLN membership
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.
./register_rln.sh
Start the node
Start all processes: nwaku node, database and grafana for metrics. Your RLN membership is loaded into nwaku under the hood.
docker-compose up -d
Your nwaku node exposes a 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
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","timestamp":'$(date +%s%N)'}'
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"
Grafana Node monitoring
Change in docker-compose.yml 127.0.0.0:3000 for 0.0.0.0:3000 and open the port 3000 in the remote machine where you're running your node.
After that you can access it at http://localhost:3000/d/yns_4vFVk/nwaku-monitoring for node metrics