merge pull request #9 from waku-org/chore/nwaku-improvements

chore: nwaku improvements
This commit is contained in:
Prem Chaitanya Prathi 2024-01-09 18:08:35 +05:30 committed by GitHub
commit 30b3aa144d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 16 deletions

10
.env.example Normal file
View File

@ -0,0 +1,10 @@
ETH_CLIENT_ADDRESS=wss://sepolia.infura.io/ws/v3/<key>
ETH_TESTNET_KEY=012345privatekey
RLN_RELAY_CRED_PASSWORD="my_secure_keystore_password"
# Advanced
GO_WAKU_IMAGE=
NODEKEY=
DOMAIN=
EXTRA_ARGS=
RLN_RELAY_CONTRACT_ADDRESS=

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
**/.DS_Store **/.DS_Store
keystore keystore
postgresql postgresql
rln_tree rln_tree
.env

View File

@ -14,12 +14,15 @@ You need:
* Ethereum Sepolia account with some balance <0.01 Eth. Get some [here](https://www.infura.io/faucet/sepolia). * 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. * A password to protect your rln membership.
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.
``` ```
export ETH_CLIENT_ADDRESS=wss://sepolia.infura.io/ws/v3/YOUR_INFURA_KEY cp .env.example .env
export ETH_TESTNET_KEY=REPLACE_BY_YOUR_KEY ${EDITOR} .env
export KEYSTORE_PASSWORD=PICK_A_PASSWORD
``` ```
Make sure to **NOT** place any secrets into `.env.example`, as they might be unintentionally published in the Git repository.
**🔑 1. Register RLN membership** **🔑 1. Register RLN membership**
The RLN membership is your access key to The Waku Network. Its registration is done onchain, and allows your go-waku node to publish messages in a decentralized and private way, respecting some [rate limits](https://rfc.vac.dev/spec/64/#rate-limit-exceeded). The RLN membership is your access key to The Waku Network. Its registration is done onchain, and allows your go-waku node to publish messages in a decentralized and private way, respecting some [rate limits](https://rfc.vac.dev/spec/64/#rate-limit-exceeded).

View File

@ -47,7 +47,7 @@ services:
environment: environment:
DOMAIN: ${DOMAIN} DOMAIN: ${DOMAIN}
NODEKEY: ${NODEKEY} NODEKEY: ${NODEKEY}
KEYSTORE_PASSWORD: ${KEYSTORE_PASSWORD} KEYSTORE_PASSWORD: "${KEYSTORE_PASSWORD}"
ETH_CLIENT_ADDRESS: *eth_client_address ETH_CLIENT_ADDRESS: *eth_client_address
EXTRA_ARGS: ${EXTRA_ARGS} EXTRA_ARGS: ${EXTRA_ARGS}
<<: <<:
@ -119,8 +119,8 @@ services:
- ./postgres_cfg/db.sql:/docker-entrypoint-initdb.d/db.sql:Z - ./postgres_cfg/db.sql:/docker-entrypoint-initdb.d/db.sql:Z
- ${PG_DATA_DIR:-./postgresql}:/var/lib/postgresql/data:Z - ${PG_DATA_DIR:-./postgresql}:/var/lib/postgresql/data:Z
command: postgres -c config_file=/etc/postgresql/postgresql.conf command: postgres -c config_file=/etc/postgresql/postgresql.conf
ports: ports: []
- 127.0.0.1:5432:5432 # - 127.0.0.1:5432:5432
healthcheck: healthcheck:
test: ["CMD-SHELL", "pg_isready -d db_prod"] test: ["CMD-SHELL", "pg_isready -d db_prod"]
interval: 30s interval: 30s

View File

@ -1,11 +1,16 @@
#!/bin/sh #!/bin/sh
if test -f ./keystore/keystore.json; then if test -f $(pwd)/keystore/keystore.json; then
echo "keystore/keystore.json alredy exists. Use it instead of creating a new one." echo "keystore/keystore.json already exists. Use it instead of creating a new one."
echo "Exiting" echo "Exiting"
exit 1 exit 1
fi fi
if test -f .env; then
echo "Using .env file"
. $(pwd)/.env
fi
# TODO: Set go-waku release when ready # TODO: Set go-waku release when ready
docker run -v $(pwd)/keystore:/keystore/:Z wakuorg/go-waku:v0.9.0 generate-rln-credentials \ docker run -v $(pwd)/keystore:/keystore/:Z wakuorg/go-waku:v0.9.0 generate-rln-credentials \
@ -13,4 +18,5 @@ docker run -v $(pwd)/keystore:/keystore/:Z wakuorg/go-waku:v0.9.0 generate-rln-c
--eth-account-private-key=${ETH_TESTNET_KEY} \ --eth-account-private-key=${ETH_TESTNET_KEY} \
--eth-contract-address=0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4 \ --eth-contract-address=0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4 \
--cred-path=/keystore/keystore.json \ --cred-path=/keystore/keystore.json \
--cred-password=${KEYSTORE_PASSWORD} --cred-password="${RLN_RELAY_CRED_PASSWORD}"

View File

@ -49,12 +49,12 @@ if [ -n "${NODEKEY}" ]; then
NODEKEY=--nodekey=${NODEKEY} NODEKEY=--nodekey=${NODEKEY}
fi fi
if [ -n "${RLN_RELAY_CRED_PATH}" ]; then
RLN_RELAY_CRED_PATH=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH} RLN_RELAY_CRED_PATH=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH:-/keystore/keystore.json}
fi
if [ -n "${RLN_RELAY_CRED_PASSWORD}" ]; then if [ -n "${RLN_RELAY_CRED_PASSWORD}" ]; then
RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password=${RLN_RELAY_CRED_PASSWORD} RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password="${RLN_RELAY_CRED_PASSWORD}"
fi fi
exec /usr/bin/waku\ exec /usr/bin/waku\
@ -98,8 +98,6 @@ exec /usr/bin/waku\
--rln-relay-eth-contract-address="${RLN_RELAY_CONTRACT_ADDRESS}"\ --rln-relay-eth-contract-address="${RLN_RELAY_CONTRACT_ADDRESS}"\
--rln-relay-eth-client-address="${ETH_CLIENT_ADDRESS}"\ --rln-relay-eth-client-address="${ETH_CLIENT_ADDRESS}"\
--rln-relay-tree-path="/etc/rln_tree"\ --rln-relay-tree-path="/etc/rln_tree"\
--rln-relay-cred-password="${KEYSTORE_PASSWORD}"\
--rln-relay-cred-path="/keystore/keystore.json"\
${RLN_RELAY_CRED_PATH}\ ${RLN_RELAY_CRED_PATH}\
${RLN_RELAY_CRED_PASSWORD}\ ${RLN_RELAY_CRED_PASSWORD}\
${DNS_WSS_CMD}\ ${DNS_WSS_CMD}\