From 2276a45dc343774255d9439bae5d9f1fca2ace26 Mon Sep 17 00:00:00 2001 From: Tanya S <120410716+stubbsta@users.noreply.github.com> Date: Wed, 16 Jul 2025 08:51:15 +0200 Subject: [PATCH] chore: Update references to RLN contract address (#147) --- .env.example | 14 +++++++++++--- README.md | 25 +++++++++++++++++++++++-- docker-compose.yml | 2 +- register_rln.sh | 4 ++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 8a1a411..2d4e314 100644 --- a/.env.example +++ b/.env.example @@ -1,12 +1,20 @@ # RPC URL for accessing testnet via HTTP. -# e.g. https://sepolia.infura.io/v3/123aa110320f4aec179150fba1e1b1b1 -RLN_RELAY_ETH_CLIENT_ADDRESS=https://sepolia.infura.io/v3/ +# e.g. https://linea-sepolia.infura.io/v3/123aa110320f4aec179150fba1e1b1b1 +RLN_RELAY_ETH_CLIENT_ADDRESS=https://linea-sepolia.infura.io/v3/ -# Private key of testnet where you have sepolia ETH that would be staked into RLN contract. +# Account of testnet where you have Linea Sepolia ETH that would be staked into RLN contract. +ETH_TESTNET_ACCOUNT= + +# Private key of testnet where you have Linea Sepolia ETH that would be staked into RLN contract. # Note: make sure you don't use the '0x' prefix. # e.g. 0116196e9a8abed42dd1a22eb63fa2a5a17b0c27d716b87ded2c54f1bf192a0b ETH_TESTNET_KEY= +# Address of the RLN contract on Linea Sepolia. +RLN_CONTRACT_ADDRESS=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6 +# Address of the RLN Membership Token contract on Linea Sepolia used to pay for membership. +TOKEN_CONTRACT_ADDRESS=0x185A0015aC462a0aECb81beCc0497b649a64B9ea + # Password you would like to use to protect your RLN membership. RLN_RELAY_CRED_PASSWORD="my_secure_keystore_password" diff --git a/README.md b/README.md index 28fd595..dfdf09c 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,10 @@ Ready to use docker-compose to run your own [nwaku](https://github.com/waku-org/ ### 📝 0. Prerequisites You need: -* Ethereum Sepolia HTTP endpoint. Get one free from [Infura](https://www.infura.io/). -* Ethereum Sepolia account with some balance <0.01 Eth. Get some [here](https://www.infura.io/faucet/sepolia). +* Linea Sepolia HTTP endpoint. Get one free from [Infura](https://www.infura.io/). +* Linea Sepolia account with some balance <0.01 Eth. +* You can get some Linea Sepolia [here](https://www.infura.io/faucet/sepolia) +* If you have ETH on Sepolia, it can be bridged to Linea Sepolia [here](https://bridge.linea.build/native-bridge). * A password to protect your rln membership. `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. @@ -40,6 +42,25 @@ The script is experimental, feedback and pull requests are welcome. 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). Messages exceeding the rate limit won't be relayed by other peers. +Before registering you need to mint and approve the tokens to pay for the registration. +The simplest way is using Foundry's [cast](https://getfoundry.sh/) tool, which you can install with: + +``` +curl -L https://foundry.paradigm.xyz | bash +foundryup +``` + +Mint the token used to pay for RLN Membership registration from your Linea Sepolia account (This is a generic ERC20 token used for testnet only): +The amount of "5000000000000000000" is how much is needed to register with a `rln-relay-user-message-limit` of 100 +``` +cast send $TOKEN_CONTRACT_ADDRESS "mint(address,uint256)" $ETH_TESTNET_ACCOUNT 5000000000000000000 --private-key $ETH_TESTNET_KEY --rpc-url $RLN_RELAY_ETH_CLIENT_ADDRESS +``` + +Approve the RLN contract to spend tokens on behalf of your account: +``` +cast send $TOKEN_CONTRACT_ADDRESS "approve(address,uint256)" $RLN_CONTRACT_ADDRESS 5000000000000000000 --private-key $ETH_TESTNET_KEY --rpc-url $RLN_RELAY_ETH_CLIENT_ADDRESS +``` + 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. diff --git a/docker-compose.yml b/docker-compose.yml index 03dbd40..4b44f74 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: "3.7" x-rln-relay-eth-client-address: &rln_relay_eth_client_address ${RLN_RELAY_ETH_CLIENT_ADDRESS:-} # Add your RLN_RELAY_ETH_CLIENT_ADDRESS after the "-" x-rln-environment: &rln_env - RLN_RELAY_CONTRACT_ADDRESS: ${RLN_RELAY_CONTRACT_ADDRESS:-0xfe7a9eabce779a090fd702346fd0bfac02ce6ac8} + RLN_RELAY_CONTRACT_ADDRESS: ${RLN_RELAY_CONTRACT_ADDRESS:-0xB9cd878C90E49F797B4431fBF4fb333108CB90e6} RLN_RELAY_CRED_PATH: ${RLN_RELAY_CRED_PATH:-} # Optional: Add your RLN_RELAY_CRED_PATH after the "-" RLN_RELAY_CRED_PASSWORD: ${RLN_RELAY_CRED_PASSWORD:-} # Optional: Add your RLN_RELAY_CRED_PASSWORD after the "-" diff --git a/register_rln.sh b/register_rln.sh index cab85ff..f168b6a 100755 --- a/register_rln.sh +++ b/register_rln.sh @@ -20,10 +20,10 @@ if test -n "${ETH_CLIENT_ADDRESS}"; then exit 1 fi -docker run -v "$(pwd)/keystore":/keystore/:Z wakuorg/nwaku:v0.35.1 generateRlnKeystore \ +docker run -v "$(pwd)/keystore":/keystore/:Z wakuorg/nwaku:v0.36.0 generateRlnKeystore \ --rln-relay-eth-client-address=${RLN_RELAY_ETH_CLIENT_ADDRESS} \ --rln-relay-eth-private-key=${ETH_TESTNET_KEY} \ ---rln-relay-eth-contract-address=0xfe7a9eabce779a090fd702346fd0bfac02ce6ac8 \ +--rln-relay-eth-contract-address=0xB9cd878C90E49F797B4431fBF4fb333108CB90e6 \ --rln-relay-cred-path=/keystore/keystore.json \ --rln-relay-cred-password="${RLN_RELAY_CRED_PASSWORD}" \ --rln-relay-user-message-limit=100 \