This document contains instructions to deploy a node using RLN v2 pointing to a new sepolia contract containing such capabilities. The following configuration is used:

Build nwaku:

make wakunode2 RLN_V2=true

Register a RLN v2 membership for node1.

./build/wakunode2 generateRlnKeystore \\
  --rln-relay-eth-client-address=https://sepolia.infura.io/v3/4576482c0f474483ac709755f2663b20 \\
  --rln-relay-eth-private-key=4350a57dc29ea5b7de1b4b2e8a09d899a6a1bd39b107736a896af0f0b9c6ca68 \\
  --rln-relay-eth-contract-address=0xABd93f37833107eDbAb58633ad5463aDEa1F95F4 \\
  --rln-relay-cred-path=keystore_rlnv2_1.json \\
  --rln-relay-cred-password=password \\
  --rln-relay-user-message-limit=10 \\
  --log-level=DEBUG \\
  --execute

Register a RLN v2 membership for node2.

./build/wakunode2 generateRlnKeystore \\
  --rln-relay-eth-client-address=https://sepolia.infura.io/v3/4576482c0f474483ac709755f2663b20 \\
  --rln-relay-eth-private-key=4350a57dc29ea5b7de1b4b2e8a09d899a6a1bd39b107736a896af0f0b9c6ca68 \\
  --rln-relay-eth-contract-address=0xABd93f37833107eDbAb58633ad5463aDEa1F95F4 \\
  --rln-relay-cred-path=keystore_rlnv2_2.json \\
  --rln-relay-cred-password=password \\
  --rln-relay-user-message-limit=10 \\
  --log-level=DEBUG \\
  --execute

Start node1.

./build/wakunode2 \\
  --relay=true\\
  --pubsub-topic=/waku/2/rs/66/0 \\
  --pubsub-topic=/waku/2/rs/66/1 \\
  --pubsub-topic=/waku/2/rs/66/2 \\
  --pubsub-topic=/waku/2/rs/66/3 \\
  --pubsub-topic=/waku/2/rs/66/4 \\
  --pubsub-topic=/waku/2/rs/66/5 \\
  --pubsub-topic=/waku/2/rs/66/6 \\
  --pubsub-topic=/waku/2/rs/66/7 \\
  --cluster-id=66 \\
  --log-level=DEBUG \\
  --rest=true \\
  --rest-admin=true \\
  --rest-address=0.0.0.0 \\
  --rest-port=8645 \\
  --rln-relay=true \\
  --rln-relay-dynamic=true \\
  --rln-relay-eth-contract-address=0xABd93f37833107eDbAb58633ad5463aDEa1F95F4 \\
  --rln-relay-eth-client-address="<https://sepolia.infura.io/v3/4576482c0f474483ac709755f2663b20>" \\
  --rln-relay-tree-path="rlnv2_tree1" \\
  --rln-relay-epoch-sec=60 \\
  --rln-relay-user-message-limit=10 \\
  --rln-relay-cred-path=keystore_rlnv2_1.json \\
  --rln-relay-cred-password=password \\
  --nodekey=5978783f8b1a16795032371fff7a526af352d9dca38179af7d71c0122942df25

Start node2 . Note that its automatically connected to node1.

./build/wakunode2 \\
  --relay=true\\
  --pubsub-topic=/waku/2/rs/66/0 \\
  --pubsub-topic=/waku/2/rs/66/1 \\
  --pubsub-topic=/waku/2/rs/66/2 \\
  --pubsub-topic=/waku/2/rs/66/3 \\
  --pubsub-topic=/waku/2/rs/66/4 \\
  --pubsub-topic=/waku/2/rs/66/5 \\
  --pubsub-topic=/waku/2/rs/66/6 \\
  --pubsub-topic=/waku/2/rs/66/7 \\
  --cluster-id=66 \\
  --log-level=DEBUG \\
  --rest=true \\
  --rest-admin=true \\
  --rest-address=0.0.0.0 \\
  --ports-shift=1 \\
  --rln-relay=true \\
  --rln-relay-dynamic=true \\
  --rln-relay-eth-contract-address=0xABd93f37833107eDbAb58633ad5463aDEa1F95F4 \\
  --rln-relay-eth-client-address="<https://sepolia.infura.io/v3/4576482c0f474483ac709755f2663b20>" \\
  --rln-relay-tree-path="rlnv2_tree2" \\
  --rln-relay-epoch-sec=60 \\
  --rln-relay-user-message-limit=10 \\
  --rln-relay-cred-path=keystore_rlnv2_2.json \\
  --rln-relay-cred-password=password \\
  --staticnode=/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmTVafvweaXrXKmFFkUo4qWYP7wTa2H6PXee8iMyQw4eHm

Inject some traffic via node1 REST API. Verify that both nodes get the traffic and that the API rejects more than 10 messages every 60 seconds.

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"}'