From 36266b43cf6e0e1806f2a5bbffbb00b9cd617545 Mon Sep 17 00:00:00 2001 From: Aaryamann Challani <43716372+rymnc@users.noreply.github.com> Date: Mon, 22 May 2023 22:06:55 +0530 Subject: [PATCH] fix(rln-relay): keystore usage (#1750) * fix(rln-relay): keystore usage * docs(rln-relay): explicit keystore usage --- .gitignore | 1 - apps/chat2/chat2.nim | 2 +- docs/tutorial/onchain-rln-relay-chat2.md | 12 ++++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 21f372df6..6e545958b 100644 --- a/.gitignore +++ b/.gitignore @@ -39,7 +39,6 @@ node_modules/ .idea/ # RLN / keystore -rlnCredentials.txt rlnKeystore.json *.tar.gz diff --git a/apps/chat2/chat2.nim b/apps/chat2/chat2.nim index 1cae36a25..482c8194f 100644 --- a/apps/chat2/chat2.nim +++ b/apps/chat2/chat2.nim @@ -592,7 +592,7 @@ proc processInput(rfd: AsyncFD, rng: ref HmacDrbgContext) {.async.} = chat.prompt = false showChatPrompt(chat) proc registrationHandler(txHash: string) {.gcsafe, closure.} = - echo "You are registered to the rln membership contract, find details of your registration transaction in https://goerli.etherscan.io/tx/0x", txHash + echo "You are registered to the rln membership contract, find details of your registration transaction in https://sepolia.etherscan.io/tx/", txHash echo "rln-relay preparation is in progress..." diff --git a/docs/tutorial/onchain-rln-relay-chat2.md b/docs/tutorial/onchain-rln-relay-chat2.md index 268a991d0..b3035a69a 100644 --- a/docs/tutorial/onchain-rln-relay-chat2.md +++ b/docs/tutorial/onchain-rln-relay-chat2.md @@ -159,13 +159,13 @@ quitting... ## How to persist and reuse RLN credential -You may pass the `rln-relay-cred-path` config option to specify a path for 1) persisting RLN credentials and 2) retrieving persisted RLN credentials. -RLN credential is persisted in the `rlnCredentials.txt` file under the specified path. -If this file does not already exist under the supplied path, then a new credential is generated and persisted in the `rlnCredentials.txt` file. -Otherwise, the chat client does not generate a new credential and will use, instead, the persisted RLN credential. +You may pass the `rln-relay-cred-path` config option to specify a path to a file for 1) persisting RLN credentials and 2) retrieving persisted RLN credentials. + +If the keystore exists in the path provided, it is used, and will default to the 0th element in the credential array. +If the keystore does not exist in the path provided, a new keystore will be created and added to the directory it was supposed to be in. ```bash -./build/chat2 --fleet:test --content-topic:/toy-chat/3/mingde/proto --rln-relay:true --rln-relay-dynamic:true --rln-relay-eth-contract-address:0x9C09146844C1326c2dBC41c451766C7138F88155 --rln-relay-eth-account-private-key:your_eth_private_key --rln-relay-eth-client-address:your_sepolia_node --ports-shift=1 --rln-relay-cred-path:./ +./build/chat2 --fleet:test --content-topic:/toy-chat/3/mingde/proto --rln-relay:true --rln-relay-dynamic:true --rln-relay-eth-contract-address:0x9C09146844C1326c2dBC41c451766C7138F88155 --rln-relay-eth-account-private-key:your_private_key --rln-relay-eth-client-address:your_sepolia_node --ports-shift=1 --rln-relay-cred-path:./rlnKeystore.json --rln-relay-cred-password:your_password ``` Note: If you are reusing credentials, you can omit the `rln-relay-eth-account-private-key` flag. @@ -173,7 +173,7 @@ Note: If you are reusing credentials, you can omit the `rln-relay-eth-account-pr Therefore, the command to start chat2 would be - ```bash -./build/chat2 --fleet:test --content-topic:/toy-chat/3/mingde/proto --rln-relay:true --rln-relay-dynamic:true --rln-relay-eth-contract-address:0x9C09146844C1326c2dBC41c451766C7138F88155 --rln-relay-eth-client-address:your_sepolia_node --ports-shift=1 --rln-relay-cred-path:./ +./build/chat2 --fleet:test --content-topic:/toy-chat/3/mingde/proto --rln-relay:true --rln-relay-dynamic:true --rln-relay-eth-contract-address:0x9C09146844C1326c2dBC41c451766C7138F88155 --rln-relay-eth-client-address:your_sepolia_node --ports-shift=1 --rln-relay-cred-path:./rlnKeystore.json --rln-relay-cred-password:your_password ``` # Sample test output