go-waku/examples/rln
Prem Chaitanya Prathi b5be83a02e
feat : autoshard relay api (#807)
* fix: using relay without bcaster should consume and drop messages

* update relay api usage

* move subscription to broadcaster

* move filter logic under subscription

* Support more than 1 relay subscription for a pubSubTopic

* modify relay Publish API to derive pubSubTopic based on autosharding

* implement relay RPC methods for autosharding

* remove relay msgChannel and relay on pubsub buffersize for subscription

Co-authored-by: richΛrd <info@richardramos.me>

* handle relay subscribe with noConsumer and address issue reported in code review

* chore: reorg relay code

---------

Co-authored-by: richΛrd <info@richardramos.me>
2023-10-21 01:26:18 +05:30
..
build fix: RLN 2023-08-01 09:19:38 -04:00
Makefile feat: make RLN available by default 2023-09-14 09:03:18 -04:00
README.md chore(rln-relay): docs and docker 2023-09-14 14:30:48 -04:00
go.mod fix: addr update 2023-10-17 09:00:30 -04:00
go.sum fix: nix build with RLN 2023-09-18 11:20:31 -04:00
main.go feat : autoshard relay api (#807) 2023-10-21 01:26:18 +05:30

README.md

Using the rln example application

Background

The rln application is a basic example app that demonstrates how to subscribe to and publish messages using Waku Relay with RLN

Preparation

Edit main.go and set proper values to these constants and variables:

const ethClientAddress = "wss://sepolia.infura.io/ws/v3/API_KEY_GOES_HERE"
const ethPrivateKey = "PRIVATE_KEY_GOES_HERE"
const contractAddress = "0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4"
const credentialsPath = ""
const credentialsPassword = ""

var contentTopic = protocol.NewContentTopic("rln", 1, "test", "proto").String()
var pubsubTopic = protocol.DefaultPubsubTopic()

The private key used here should contain enough Sepolia ETH to register on the contract (0.001 ETH). An ethereum client address is required as well. After updating these values, execute make

Basic application usage

To start the rln application run the following from the project directory

./build/rln

The app will send a "Hello world!" through the waku relay protocol every 2 seconds and display it on the terminal as soon as it receives the message. Only a single message per epoch is allowed, so 4 out of 5 messages will be considered spam.