RLN+Interep contract
Go to file
rymnc edd33f10d4
feat: correct snark artifacts :)
2022-12-07 18:36:02 +05:30
.github/workflows fix(ci): add lint check 2022-11-25 11:39:40 +05:30
.husky fix: precommit fmt 2022-11-25 12:09:12 +05:30
common feat: ready for demo 2022-12-06 13:46:27 +05:30
contracts feat: withdrawals/slashing implemented on interep 2022-12-02 12:49:11 +05:30
deploy feat: ready for demo 2022-12-06 13:46:27 +05:30
deployments docs: instructions for running with nwaku 2022-12-06 17:26:04 +05:30
e2e feat: add the old snark artifacts that interep uses 2022-12-07 18:12:30 +05:30
test feat: correct snark artifacts :) 2022-12-07 18:36:02 +05:30
ui feat: add the old snark artifacts that interep uses 2022-12-07 18:12:30 +05:30
.env.example Initializing Repository 2022-06-23 15:36:10 +02:00
.eslintignore Initializing Repository 2022-06-23 15:36:10 +02:00
.eslintrc.js Initializing Repository 2022-06-23 15:36:10 +02:00
.gitignore chore: create e2e script that adds member via interep 2022-12-06 16:20:01 +05:30
.npmignore Initializing Repository 2022-06-23 15:36:10 +02:00
.prettierignore Initializing Repository 2022-06-23 15:36:10 +02:00
.prettierrc Initializing Repository 2022-06-23 15:36:10 +02:00
.solcover.js style: fmt 2022-11-25 11:38:38 +05:30
.solhint.json Initializing Repository 2022-06-23 15:36:10 +02:00
.solhintignore Initializing Repository 2022-06-23 15:36:10 +02:00
README.md docs: instructions for running with nwaku 2022-12-06 17:26:04 +05:30
hardhat.config.ts feat: ready for demo 2022-12-06 13:46:27 +05:30
package.json docs: instructions for running with nwaku 2022-12-06 17:26:04 +05:30
tsconfig.json feat: e2e test 2022-12-02 16:57:20 +05:30
yarn.lock chore: use ganache instead of hardhat for local dev - websocket 2022-12-06 11:59:07 +05:30

README.md

Hardhat Project for Rln-interep-contract

Compilation

yarn compile

Testing

yarn test

Test with Waku-RLN-Relay (chat2)

  1. Clone nwaku and switch to the rln-interep-poc branch

  2. Fetch dependencies

    yarn
    
  3. In a different terminal window, start the local eth node

    yarn start
    
  4. In a new terminal window, run the deployment script and the interep group registration script

    yarn deploy localhost_integration --reset && yarn e2e 11d5888ff45486b90a506367a4262e65a097c4b8eb509f3db01fbff714a96cbb
    

    The string after yarn e2e is used for deterministic credential generation.

    Make note of the ID Commitment, ID Key and Index from the output of running the e2e script.

  5. Open 3 terminal windows with nwaku as the base directory

  6. In one of them, build chat2

    make -j8 chat2 RLN=true
    
  7. Run Alice's chat2 instance

     ./build/chat2 --fleet:none --content-topic:/toy-chat/2/luzhou/proto --rln-relay:true --rln-relay-dynamic:true --rln-relay-eth-contract-address:<use-the-contract-from-step-4> --rln-relay-eth-client-address:ws://localhost:8545 --ports-shift:5 --rln-relay-eth-account-private-key:3c914dff62bd200e1e1b1af9d40eace4bc70875d1007b8cad4a950d3c7b3e442 --log-level=DEBUG
    # Choose a nickname >> Alice
    

    Make note of Alice's peer address

  8. In a different window, run Bob's chat2 instance

    ./build/chat2 --fleet:none --content-topic:/toy-chat/2/luzhou/proto --rln-relay:true --rln-relay-dynamic:true --rln-relay-eth-contract-address:<use-the-contract-from-step-4> --rln-relay-eth-client-address:ws://localhost:8545 --ports-shift:5 --rln-relay-eth-account-private-key:3c914dff62bd200e1e1b1af9d40eace4bc70875d1007b8cad4a950d3c7b3e442 --log-level=DEBUG --staticnode:<alice-peer-address>
    # Choose a nickname >> Bob
    
  9. In a different window, run Carol's chat2 instance (we will use the same credentials that we used for Interep)

    ./build/chat2 --fleet:none --content-topic:/toy-chat/2/luzhou/proto --rln-relay:true --rln-relay-dynamic:true --rln-relay-eth-contract-address:<use-the-contract-from-step-4> --rln-relay-eth-client-address:ws://localhost:8545 --ports-shift:5 --rln-relay-id-commitment-key:<from-output-of-step-4> --rln-relay-id-key:<from-output-of-step-4> --rln-relay-membership-index:<from-output-of-step-4> --log-level=DEBUG --staticnode:<alice-peer-address>
    # Choose a nickname >> Carol
    
  10. Now you can send messages from Carol, and they will be validated by Alice. Spam messages will be detected and dropped before relaying to Bob.

Deploying

  • To deploy on local node, first start the local node and then run the deploy script
yarn start
yarn deploy:localhost
  • To deploy to an target network (like Goerli), use the name as mentioned in the Hardhat config file.
yarn deploy:goerli

References

For more information, see https://hardhat.org/hardhat-runner/docs/guides/project-setup