From 72c77adaf91d1f6145adfe4dd51bca060f80d685 Mon Sep 17 00:00:00 2001 From: fryorcraken <110212804+fryorcraken@users.noreply.github.com> Date: Fri, 2 Feb 2024 07:03:49 +1100 Subject: [PATCH] fix: include timestamp in curl command (#31) Co-authored-by: Vaclav Pavlin --- .gitignore | 1 + README.md | 5 +++-- register_rln.sh | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0536e1c..ba1cb8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ **/.DS_Store +.env keystore postgresql rln_tree diff --git a/README.md b/README.md index 627ef9d..6f8ae01 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ 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. +`docker-compose` [will read the `./.env` file](https://docs.docker.com/compose/environment-variables/set-environment-variables/#additional-information-3) from the filesystem. 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. ``` cp .env.example .env @@ -23,6 +23,7 @@ ${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 nwaku node to publish messages in a decentralized and private way, respecting some [rate limits](https://rfc.vac.dev/spec/64/#rate-limit-exceeded). @@ -62,7 +63,7 @@ curl http://127.0.0.1:8645/debug/v1/info ``` 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"}' + -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. diff --git a/register_rln.sh b/register_rln.sh index 75e4541..e5d39cd 100755 --- a/register_rln.sh +++ b/register_rln.sh @@ -1,11 +1,15 @@ #!/bin/sh -if test -f $(pwd)/keystore/keystore.json; then - echo "keystore/keystore.json alredy exists. Use it instead of creating a new one." + +if test -f ./keystore/keystore.json; then + echo "keystore/keystore.json already exists. Use it instead of creating a new one." echo "Exiting" exit 1 fi + +mkdir -p ./keystore + if test -f .env; then echo "Using .env file" . $(pwd)/.env