diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..9787ffb --- /dev/null +++ b/.env.example @@ -0,0 +1,10 @@ +ETH_CLIENT_ADDRESS=wss://sepolia.infura.io/ws/v3/ +ETH_TESTNET_KEY=012345privatekey +RLN_RELAY_CRED_PASSWORD="my_secure_keystore_password" + +# Advanced +GO_WAKU_IMAGE= +NODEKEY= +DOMAIN= +EXTRA_ARGS= +RLN_RELAY_CONTRACT_ADDRESS= diff --git a/.gitignore b/.gitignore index 87d7420..0536e1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ **/.DS_Store keystore postgresql -rln_tree \ No newline at end of file +rln_tree +.env diff --git a/README.md b/README.md index 3ad3224..0ddb4af 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,15 @@ You need: * 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. +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 -export ETH_TESTNET_KEY=REPLACE_BY_YOUR_KEY -export KEYSTORE_PASSWORD=PICK_A_PASSWORD +cp .env.example .env +${EDITOR} .env ``` +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 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). diff --git a/docker-compose.yml b/docker-compose.yml index 81d0299..4190cea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -47,7 +47,7 @@ services: environment: DOMAIN: ${DOMAIN} NODEKEY: ${NODEKEY} - KEYSTORE_PASSWORD: ${KEYSTORE_PASSWORD} + KEYSTORE_PASSWORD: "${KEYSTORE_PASSWORD}" ETH_CLIENT_ADDRESS: *eth_client_address EXTRA_ARGS: ${EXTRA_ARGS} <<: @@ -119,8 +119,8 @@ services: - ./postgres_cfg/db.sql:/docker-entrypoint-initdb.d/db.sql:Z - ${PG_DATA_DIR:-./postgresql}:/var/lib/postgresql/data:Z command: postgres -c config_file=/etc/postgresql/postgresql.conf - ports: - - 127.0.0.1:5432:5432 + ports: [] + # - 127.0.0.1:5432:5432 healthcheck: test: ["CMD-SHELL", "pg_isready -d db_prod"] interval: 30s diff --git a/register_rln.sh b/register_rln.sh index 555ede3..f181ed2 100755 --- a/register_rln.sh +++ b/register_rln.sh @@ -1,11 +1,16 @@ #!/bin/sh -if test -f ./keystore/keystore.json; then - echo "keystore/keystore.json alredy exists. Use it instead of creating a new one." +if test -f $(pwd)/keystore/keystore.json; then + echo "keystore/keystore.json already exists. Use it instead of creating a new one." echo "Exiting" exit 1 fi +if test -f .env; then + echo "Using .env file" + . $(pwd)/.env +fi + # TODO: Set go-waku release when ready 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-contract-address=0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4 \ --cred-path=/keystore/keystore.json \ ---cred-password=${KEYSTORE_PASSWORD} \ No newline at end of file +--cred-password="${RLN_RELAY_CRED_PASSWORD}" + diff --git a/run_node.sh b/run_node.sh index 8c99318..2c6bad3 100644 --- a/run_node.sh +++ b/run_node.sh @@ -49,12 +49,12 @@ if [ -n "${NODEKEY}" ]; then NODEKEY=--nodekey=${NODEKEY} fi -if [ -n "${RLN_RELAY_CRED_PATH}" ]; then - RLN_RELAY_CRED_PATH=--rln-relay-cred-path=${RLN_RELAY_CRED_PATH} -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} + RLN_RELAY_CRED_PASSWORD=--rln-relay-cred-password="${RLN_RELAY_CRED_PASSWORD}" fi exec /usr/bin/waku\ @@ -98,8 +98,6 @@ exec /usr/bin/waku\ --rln-relay-eth-contract-address="${RLN_RELAY_CONTRACT_ADDRESS}"\ --rln-relay-eth-client-address="${ETH_CLIENT_ADDRESS}"\ --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_PASSWORD}\ ${DNS_WSS_CMD}\