Combines five dep-and-build changes that all flow from the libp2p v2.0.0
upgrade and the move to the extracted libp2p_mix / mix-rln plugin stack:
waku.nimble:
* libp2p: ff8d51857 -> c43199378 (release/v2.0.0 tip; sha-pinned until
vacp2p cuts a v2.0.0 tag).
* Drop the bare `zlib < 0.2` cap — no longer needed by the upgraded
libp2p.
* websock: bare ">= 0.4.0" — replaces the d4cd68b URL+SHA workaround
that pinned through a libp2p commit-specific websock SHA.
* nim-json-rpc: switch to chaitanyaprem/nim-json-rpc#f05fad25 — relaxes
websock cap to allow >=0.4.0. TODO: revert to status-im/nim-json-rpc
once status-im/nim-json-rpc#277 merges and a tag is cut.
* lsquic: bare ">= 0.4.1" (drops URL form).
* Add mix-rln-spam-protection-plugin pin (23b278b4) and nim-libp2p-mix
pin (50c4ab4f — PR #14 HEAD); the plugin pins the same libp2p_mix
SHA so the diamond dep collapses to a single source.
waku/factory/waku.nim:
* Explicit HPService.setup(switch) / AutonatService.setup(switch)
calls. libp2p v2.0.0's Service lifecycle refactor (libp2p#2462)
removed switch.start's auto-setup loop, so any caller that assigns
directly to switch.services (we do) is responsible for calling
setup() themselves. Without it, AutonatService.addressMapper stays
nil and peerInfo.expandAddrs SIGSEGVs during start(). Wrapped in
try/except for ServiceSetupError so a setup failure surfaces as a
logged error rather than a crash.
Build / scripts:
* scripts/build_rln_mix.sh removed and Makefile simplified — librln
is now a single shared archive built from zerokit's `stateless`
features (no separate librln_mix archive).
* simulations/mixnet/build_setup.sh + setup_credentials.nim updated
to use librln_v2.0.2.a directly and run RLN keystore setup before
nodes start.
Validated:
* Cold local-cache nimble setup --localdeps -y.
* wakunode2 and chat2mix link cleanly.
* Mixnet roundtrip sim: [PASS] bob received message from alice.
* RLN proof generation + verification on every in-path mix node:
5 gen_called == 5 verified, 0 SPAM_PROOF_* errors.
Mixnet simulation
Aim
Simulate a local mixnet along with a chat app to publish using mix. This is helpful to test any changes during development.
Simulation Details
The simulation includes:
- A 5-node mixnet where
run_mix_node.shis the bootstrap node for the other 4 nodes - Two chat app instances that publish messages using lightpush protocol over the mixnet
Available Scripts
| Script | Description |
|---|---|
run_mix_node.sh |
Bootstrap mix node (must be started first) |
run_mix_node1.sh |
Mix node 1 |
run_mix_node2.sh |
Mix node 2 |
run_mix_node3.sh |
Mix node 3 |
run_mix_node4.sh |
Mix node 4 |
run_chat_mix.sh |
Chat app instance 1 |
run_chat_mix1.sh |
Chat app instance 2 |
build_setup.sh |
Build and generate RLN credentials |
Prerequisites
Before running the simulation, build wakunode2 and chat2mix:
cd <repo-root-dir>
source env.sh
make wakunode2 chat2mix
RLN Spam Protection Setup
Generate RLN credentials and the shared Merkle tree for all nodes:
cd simulations/mixnet
./build_setup.sh
This script will:
- Build and run the
setup_credentialstool - Generate RLN credentials for all nodes (5 mix nodes + 2 chat clients)
- Create
rln_tree.db- the shared Merkle tree with all members - Create keystore files (
rln_keystore_{peerId}.json) for each node
Important: All scripts must be run from this directory (simulations/mixnet/) so they can access their credentials and tree file.
To regenerate credentials (e.g., after adding new nodes), run ./build_setup.sh again - it will clean up old files first.
Usage
Step 1: Start the Mix Nodes
Start the bootstrap node first (in a separate terminal):
./run_mix_node.sh
Look for the following log lines to ensure the node started successfully:
INF mounting mix protocol topics="waku node"
INF Node setup complete topics="wakunode main"
Verify RLN spam protection initialized correctly by checking for these logs:
INF Initializing MixRlnSpamProtection
INF MixRlnSpamProtection initialized, waiting for sync
DBG Tree loaded from file
INF MixRlnSpamProtection started
Then start the remaining mix nodes in separate terminals:
./run_mix_node1.sh
./run_mix_node2.sh
./run_mix_node3.sh
./run_mix_node4.sh
Step 2: Start the Chat Applications
Once all 5 mix nodes are running, start the first chat app:
./run_chat_mix.sh
Enter a nickname when prompted:
pubsub topic is: /waku/2/rs/2/0
Choose a nickname >>
Once you see the following log, the app is ready to publish messages over the mixnet:
Welcome, test!
Listening on
/ip4/<local-network-ip>/tcp/60000/p2p/16Uiu2HAkxDGqix1ifY3wF1ZzojQWRAQEdKP75wn1LJMfoHhfHz57
ready to publish messages now
Start the second chat app in another terminal:
./run_chat_mix1.sh
Step 3: Test Messaging
Once both chat apps are running, send a message from one and verify it is received by the other.
To exit the chat apps, enter /exit:
>> /exit
quitting...