Awesome
flashbots-privacy
Practical Experiments on how to add complete privacy to flashbots
Overview
This repository contains snippets, ideas, etc on specific portions of the Flashbots stack that could potentially be improved via the use of privacy enhancing technologies (PETs). So far, we have the following experiments:
mpc_bundle_scoring
: Computing Flashbots' bundle scoring algorithm using multiparty computation (MPC)mpc_block_knapsack
: Dynamic Programming solver for block building implemented in MPCmpc_knapsack_auction
: Greedy-based knapsack auction for block building implemented in MPCmpc_shifting_knapsack
: An alternative to the dynamic programing solver without using ORAM.
How to run
We have built a testing script to execute experiments using different combinations of parameters. To execute the script you first need to compile the virtual machines of the protocols that you want to test. To do this, we refer to the user to the MP-SDPZ documentation where you can find a how to compile such virtual machines. We suggest to run the following command to compile all the supported MP-SDPZ virtual machines at once:
cd MP-SDPZ
make -j8
In the case that you don't want to test several protocols, you may compile just the virtual machine that you need. For example, to compile the virtual machine for the protocol MASCOT, you can execute the following command:
cd MP-SDPZ
make -j8 mascot-party.x
Before executing the scripts you need to modify the contents of experiment/config.json
, specifically, the experiments
list. The script will execute all the experiments with the parameters specified in the JSON file. You can add as many experiments as you wish with different protocols, algorithms, parties, etc. An example of an experiment object that can be included in the list is presented next:
{
"algorithm": "mpc_shifting_knapsack/shifting_knapsack.mpc",
"protocol": "mal-shamir.sh",
"max_weight": 20,
"max_value": 10,
"n_parties": 4,
"repetitions": 2,
"tx_per_party": 5,
"in_parallel": false,
"has_net_limit": false,
"net_limits": {
"bandwidth": "10gbps",
"latency": "0.3ms"
}
}
In the algorithm
field you need to specify the path to the .mpc
file relative to the algorithm that you want to test. The protocol
field should have the name of the .sh
file consistent with the available protocols in the MP-SDPZ framework. You can find all the .sh
files supported here. The field has_net_limits
is a boolean that defines if the protocol will be executed with a specified bandwidth and latency. If this flag is set to true
, you need to specify the desired bandwidth and latency in the net_limits
JSON object. The bandwidth and latency must be specified according to the parameters section in the tc
command documentation. The tool allows to execute one experiment multiple times by setting the repetitions
field. Then, the tool will output the average of the running time of each repetition as the result of the experiment. Also, the tool will save all the results for each execution in a .txt
file inside the experiment/
folder. The in_parallel
field is a flag that allow to execute the repetitions for each experiment in parallel using half of the CPU cores.
Once the JSON config file has all the desired experiments to be executed, you can run the experiments using the command
sudo python3 experiment/run_experiment.py
This testing tool works for the following algorithms:
mpc_block_knapsack/knapsack.mpc
mpc_knapsack_auction/knapsack_auction.mpc
mpc_shifting_knapsack/shifting_knapsack.mpc