nomos-specs/mixnet/v2/sim/README.md

69 lines
3.4 KiB
Markdown
Raw Normal View History

2024-05-12 23:49:09 +00:00
# Mixnet v2 Simulation
2024-05-15 10:41:48 +00:00
* [How to Run](#how-to-run)
+ [Time in simulation](#time-in-simulation)
2024-05-15 10:19:55 +00:00
* [Mixnet Functionalities](#mixnet-functionalities)
* [Adversary Models](#adversary-models)
2024-05-15 10:41:48 +00:00
## How to Run
2024-05-12 23:49:09 +00:00
2024-05-14 12:19:46 +00:00
First, make sure that all dependencies specified in the `requirements.txt` in the project root.
2024-05-15 10:19:55 +00:00
Then, configure parameters in the [`config.yaml`](./config.yaml), and run the following command:
2024-05-12 23:49:09 +00:00
```bash
2024-05-14 12:19:46 +00:00
python main.py --config ./config.yaml
2024-05-13 06:13:21 +00:00
```
2024-05-15 10:19:55 +00:00
The simulation runs during a specified duration, prints the results to the console, and show some plots.
2024-05-12 23:49:09 +00:00
2024-05-15 10:41:48 +00:00
### Time in simulation
The simulation has been implemented based on [SimPy](https://simpy.readthedocs.io/en/latest/) which is discrete-event simulation framework.
All events are processed sequentially by a single thread.
However, multiple parallel events, which should be processed at the same time, can be also simulated by scheduling them at the same "time".
The simulation has the virtual time concept, which doesn't have the same scale as the real time.
If the event A is scheduled to happen at time 10, and the event B is scheduled to happen at time 11,
the simulation guarantees that the event B happens only after the event A happens.
But, it doesn't mean that the event B happens exactly 1 second after the event A. It will be much shorter.
If two events are scheduled at the same time (e.g. 10), the simulation processes the one that is scheduled first and the other one next (FIFO).
But, it is guarantees that those two event are processed before the events scheduled at time 11+.
Using this virtual time, complex distributed systems can be simulated in a simple way without worrying about the real-time synchronization.
For more details, please see the [Time and Scheduling](https://simpy.readthedocs.io/en/latest/topical_guides/time_and_scheduling.html#what-is-time) section in the SimPy documentation.
2024-05-15 10:19:55 +00:00
## Mixnet Functionalities
2024-05-13 07:02:42 +00:00
- Modified Sphinx
- [x] Without encryption
- [ ] With encryption
- P2P Broadcasting
2024-05-16 05:33:31 +00:00
- [x] Naive 1-to-all
2024-05-13 07:02:42 +00:00
- [ ] More realistic broadcasting (e.g. gossipsub)
2024-05-15 10:19:55 +00:00
- [x] Sending a real message to the mixnet at the promised interval
- Each node has its own probability of sending a real message at each interval.
- [x] Cover traffic
- All nodes have the same probability of sending a cover message at each interval.
- [x] Forwarding messages through mixes, and then broadcasting messages to all nodes if the message is real.
2024-05-13 07:02:42 +00:00
- Mix delays
- [x] Naive random delays
2024-05-15 10:19:55 +00:00
- [ ] More sophisticated delays (e.g. Poisson) if necessary
## [Adversary Models](https://www.notion.so/Mixnet-v2-Proof-of-Concept-102d0563e75345a3a6f1c11791fbd746?pvs=4#c5ffa49486ce47ed81d25028bc0d9d40)
- [x] Inspecting message sizes to analyze how far each message has traveled since emitted by the original sender.
- Currently, all messages have the same size (including messages broadcasted after being fully unwrapped). Thus, the adversary can learn nothing.
```
message_size
count 1806.0
mean 1937.0
std 0.0
min 1937.0
25% 1937.0
50% 1937.0
75% 1937.0
max 1937.0
```
2024-05-15 10:19:55 +00:00
- [x] Identifying nodes emitting messages around the promised interval.
- [ ] With partial visibility
2024-05-16 04:57:00 +00:00
- [ ] Quantifying how much the expected frequent senders are anonymized by cover traffic
2024-05-16 04:57:39 +00:00
![](./docs/msgs-around-interval.png)
2024-05-15 10:19:55 +00:00
- [ ] Correlating senders-receivers based on timing
2024-05-16 04:58:32 +00:00
- [ ] Active attacks