docs: instructions for running with nwaku

This commit is contained in:
rymnc 2022-12-06 17:26:04 +05:30
parent 1b16f5eed7
commit 6c972f51b6
No known key found for this signature in database
GPG Key ID: AAA088D5C68ECD34
7 changed files with 104 additions and 43 deletions

View File

@ -7,10 +7,70 @@ yarn compile
```
## Testing
```shell
yarn test
```
## Test with Waku-RLN-Relay (chat2)
1. Clone [nwaku](https://github.com/waku-org/nwaku) and switch to the `rln-interep-poc` branch
2. Fetch dependencies
```shell
yarn
```
3. In a different terminal window, start the local eth node
```shell
yarn start
```
4. In a new terminal window, run the deployment script and the interep group registration script
```shell
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`
```shell
make -j8 chat2 RLN=true
```
7. Run Alice's chat2 instance
```shell
./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
```shell
./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)
```shell
./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
@ -25,6 +85,7 @@ yarn deploy:localhost
```shell
yarn deploy:goerli
```
## References
For more information, see https://hardhat.org/hardhat-runner/docs/guides/project-setup
For more information, see https://hardhat.org/hardhat-runner/docs/guides/project-setup

View File

@ -1,5 +1,5 @@
{
"address": "0x0b8AC9ca6a6a6a3644Dcd72bF89421aD8378bAf4",
"address": "0x36A3342b5d402F30CA566B339d861A3Ce1A203Bd",
"abi": [
{
"inputs": [
@ -253,18 +253,18 @@
"type": "function"
}
],
"transactionHash": "0x1d22a4c9ac3aa353a7a031954e00cb1da43f7b65dee6a374200db3514e16d23b",
"transactionHash": "0x042cf74bf2acdf3dda67a8a9679a6dfcdf5fcc4fe216e97a81b314d4fe66c76b",
"receipt": {
"to": null,
"from": "0x426cecD107f309E0C20717e0d48656799806789E",
"contractAddress": "0x0b8AC9ca6a6a6a3644Dcd72bF89421aD8378bAf4",
"from": "0xC4d5292b18412bdAEd37E278F4aB6973DEa025B8",
"contractAddress": "0x36A3342b5d402F30CA566B339d861A3Ce1A203Bd",
"transactionIndex": 0,
"gasUsed": "1097158",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xd6b272d19228ffbf4763b1f095555907c4964b054fe03cf4b4db20fa946c626e",
"transactionHash": "0x1d22a4c9ac3aa353a7a031954e00cb1da43f7b65dee6a374200db3514e16d23b",
"blockHash": "0xd81957ce0e7a7c20a2edbf88adc35ef50e13f8d799ad609fea4881a02271c381",
"transactionHash": "0x042cf74bf2acdf3dda67a8a9679a6dfcdf5fcc4fe216e97a81b314d4fe66c76b",
"logs": [],
"blockNumber": 16,
"blockNumber": 3,
"cumulativeGasUsed": "1097158",
"status": 1,
"byzantium": true
@ -272,7 +272,7 @@
"args": [
[
{
"contractAddress": "0x265b14357e6aF9C9115F9175e3e48a1Bb0fe5f6d",
"contractAddress": "0x6C4C4C369d55E86F922C64f5cF33C057AEf28477",
"merkleTreeDepth": 20
}
]

View File

@ -1,5 +1,5 @@
{
"address": "0x9DcFeeA01aACc227930C107533eAD3457B58FaB5",
"address": "0x87E9587d9C7b635859EDBaD7D3C223230C5b6e31",
"abi": [
{
"inputs": [
@ -34,18 +34,18 @@
"type": "function"
}
],
"transactionHash": "0x815197b4172b95632dcf0cade0674f2b7d3865b603a627fb61c1f14611b159a5",
"transactionHash": "0xb6291c7646b7336ffd8e8dc681b38f37c492d493119fd24882fe4cda3d133b87",
"receipt": {
"to": null,
"from": "0x426cecD107f309E0C20717e0d48656799806789E",
"contractAddress": "0x9DcFeeA01aACc227930C107533eAD3457B58FaB5",
"from": "0xC4d5292b18412bdAEd37E278F4aB6973DEa025B8",
"contractAddress": "0x87E9587d9C7b635859EDBaD7D3C223230C5b6e31",
"transactionIndex": 0,
"gasUsed": "3507975",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xfcb1273b5415f46beda1ef0bc0eea5cf14debf9657e392cdda5f4e2ff2de1405",
"transactionHash": "0x815197b4172b95632dcf0cade0674f2b7d3865b603a627fb61c1f14611b159a5",
"blockHash": "0x83e11daf8e644e0680f0ff5bb489a9fdaf2f3b9d60b58527fd12191d4e62faaa",
"transactionHash": "0xb6291c7646b7336ffd8e8dc681b38f37c492d493119fd24882fe4cda3d133b87",
"logs": [],
"blockNumber": 8,
"blockNumber": 1,
"cumulativeGasUsed": "3507975",
"status": 1,
"byzantium": true

View File

@ -1,5 +1,5 @@
{
"address": "0x7ab458e421B4292B9453763e3E59f562F8A346de",
"address": "0x37312300F863CC84eC217F8F0aeEE12008dDDa59",
"abi": [
{
"inputs": [
@ -302,27 +302,27 @@
"type": "function"
}
],
"transactionHash": "0xa1ea6d8dea11fd91943cf8a11ee963c099d9fc602b0a4544d4ac1bd7d94a4dfe",
"transactionHash": "0xf8753adaf6feace2825757cdb4eb6fccc7805ccfdb7296b7b1430ba257c19476",
"receipt": {
"to": null,
"from": "0x426cecD107f309E0C20717e0d48656799806789E",
"contractAddress": "0x7ab458e421B4292B9453763e3E59f562F8A346de",
"from": "0xC4d5292b18412bdAEd37E278F4aB6973DEa025B8",
"contractAddress": "0x37312300F863CC84eC217F8F0aeEE12008dDDa59",
"transactionIndex": 0,
"gasUsed": "1837815",
"gasUsed": "1837827",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xb46a362ed47f5cad13926b331f9171cb2a8e7b581e8bd6c997abefa670c351d8",
"transactionHash": "0xa1ea6d8dea11fd91943cf8a11ee963c099d9fc602b0a4544d4ac1bd7d94a4dfe",
"blockHash": "0x52c076c138ac3c8b98641096687e8c50c9330280c7685e58e8ba2adeb3c01b5c",
"transactionHash": "0xf8753adaf6feace2825757cdb4eb6fccc7805ccfdb7296b7b1430ba257c19476",
"logs": [],
"blockNumber": 28,
"cumulativeGasUsed": "1837815",
"blockNumber": 6,
"cumulativeGasUsed": "1837827",
"status": 1,
"byzantium": true
},
"args": [
1000000000000000,
20,
"0x9DcFeeA01aACc227930C107533eAD3457B58FaB5",
"0x8785643D4908eC672f007d61a610A8ba6AbaE8C0"
"0x87E9587d9C7b635859EDBaD7D3C223230C5b6e31",
"0x97A0acd6b6B96be6F8A0D5730AdccC25Bef0f87b"
],
"numDeployments": 1,
"solcInputHash": "b8e33ba299e95051cdf4858cd81bbca9",

View File

@ -1,5 +1,5 @@
{
"address": "0x8785643D4908eC672f007d61a610A8ba6AbaE8C0",
"address": "0x97A0acd6b6B96be6F8A0D5730AdccC25Bef0f87b",
"abi": [
{
"inputs": [
@ -81,24 +81,24 @@
"type": "function"
}
],
"transactionHash": "0x48265678b66017a69608e3ee361c525cd2684e1d71e6e0d778afa3dfc2388c40",
"transactionHash": "0xde3d695370db7386f65e05b1541d5455fa88719a5bc181c50873b45153eb6e61",
"receipt": {
"to": null,
"from": "0x426cecD107f309E0C20717e0d48656799806789E",
"contractAddress": "0x8785643D4908eC672f007d61a610A8ba6AbaE8C0",
"from": "0xC4d5292b18412bdAEd37E278F4aB6973DEa025B8",
"contractAddress": "0x97A0acd6b6B96be6F8A0D5730AdccC25Bef0f87b",
"transactionIndex": 0,
"gasUsed": "397310",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x5183981c52b36326c03bc0f8f36bcfa94e1b5476f068dfd65c6b4b6ed62ed2b4",
"transactionHash": "0x48265678b66017a69608e3ee361c525cd2684e1d71e6e0d778afa3dfc2388c40",
"blockHash": "0xbda48f0553ae7c0a44de5f216146bd26311aef60bc19c8883f5e808cc4e188e6",
"transactionHash": "0xde3d695370db7386f65e05b1541d5455fa88719a5bc181c50873b45153eb6e61",
"logs": [],
"blockNumber": 24,
"blockNumber": 5,
"cumulativeGasUsed": "397310",
"status": 1,
"byzantium": true
},
"args": [
"0x0b8AC9ca6a6a6a3644Dcd72bF89421aD8378bAf4",
"0x36A3342b5d402F30CA566B339d861A3Ce1A203Bd",
[
{
"provider": "0x6769746875620000000000000000000000000000000000000000000000000000",

View File

@ -1,5 +1,5 @@
{
"address": "0x265b14357e6aF9C9115F9175e3e48a1Bb0fe5f6d",
"address": "0x6C4C4C369d55E86F922C64f5cF33C057AEf28477",
"abi": [
{
"inputs": [],
@ -35,18 +35,18 @@
"type": "function"
}
],
"transactionHash": "0xe17018e6e38070d1a2ebb9c6d03a942c14203093d43534b8d5749565539722a1",
"transactionHash": "0x6e45a5870b48bd3998791fe589c7b5226b85a77d811037a31dc7f9a40c5d7dd3",
"receipt": {
"to": null,
"from": "0x426cecD107f309E0C20717e0d48656799806789E",
"contractAddress": "0x265b14357e6aF9C9115F9175e3e48a1Bb0fe5f6d",
"from": "0xC4d5292b18412bdAEd37E278F4aB6973DEa025B8",
"contractAddress": "0x6C4C4C369d55E86F922C64f5cF33C057AEf28477",
"transactionIndex": 0,
"gasUsed": "1383001",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xd3a867f3f8e52668595543c1ee7cbf47738ce152747b6b10fc9381a9a7284654",
"transactionHash": "0xe17018e6e38070d1a2ebb9c6d03a942c14203093d43534b8d5749565539722a1",
"blockHash": "0xbd772c1e3a109bb345358049e746b1f71b8e68f3fbda382d232e2d3ba050be45",
"transactionHash": "0x6e45a5870b48bd3998791fe589c7b5226b85a77d811037a31dc7f9a40c5d7dd3",
"logs": [],
"blockNumber": 12,
"blockNumber": 2,
"cumulativeGasUsed": "1383001",
"status": 1,
"byzantium": true

View File

@ -2,7 +2,7 @@
"name": "rln-interep-contracts",
"license": "MIT",
"scripts": {
"start": "ganache --chain.chainId 31337",
"start": "ganache --chain.chainId 31337 --wallet.accounts=0x3c914dff62bd200e1e1b1af9d40eace4bc70875d1007b8cad4a950d3c7b3e442,1000000000000000000",
"compile": "hardhat compile",
"test": "hardhat test",
"test:localhost": "yarn test --network localhost",