Please note, that this document is geared towards building docker images for the HoneyBadgerSwap research project. That being said, it may be quite simple to adapt it to your own research and development needs. This is by no means meant for production use.
Clone the MP-SPDZ repository fork, e.g.
git clone --branch dev https://github.com/initc3/MP-SPDZ.git /tmp/MP-SPDZ
If you need a specific commit or branch, check it out, e.g.:
git checkout d686efcada9efef08cd0573e1aafc478f02d5fcf
docker build --target bulidenv --tag mpspdz:bulidenv .
To push to DockerHub, tag the image accordingly, e.g.:
docker tag mpspdz:base initc3/mpspdz:$(git log -n 1 --pretty=format:%h)
and push it:
docker push initc3/mpspdz:$(git log -n 1 --pretty=format:%h)
A specific program can be built by passing the --build-arg
option to docker.
For example, to build mal-shamir-offline.x
:
docker build \
--tag mpspdz:mal-shamir-offline.x \
--target machine \
--build-arg machine=mal-shamir-offline.x \
--build-arg gfp_mod_sz=4 \
--build-arg prep_dir=/opt/preprocessing-data \
--build-arg ssl_dir=/opt/ssl \
--build-arg cryptoplayers=4 .
Tag it and push, e.g.:
docker tag mal-shamir-offline.x:latest \
initc3/mal-shamir-offline.x:$(git log -n 1 --pretty=format:%h)
and publish it:
docker push initc3/mal-shamir-offline.x:$(git log -n 1 --pretty=format:%h)
cryptoplayers=4
: number of players
gfp_mod_sz=4
: for primes > 256 bits, number of limbs (prime length
divided by 64 rounded up)
prep_dir="/opt/preprocessing-data"
: directory where to store preprocessing data
For other build arguments, see the ARG
instructions in the
Dockerfile
.
docker build \
--tag mpspdz:malicious-shamir-party.x \
--target machine \
--build-arg machine=malicious-shamir-party.x \
--build-arg gfp_mod_sz=4 \
--build-arg prep_dir=/opt/preprocessing-data \
--build-arg ssl_dir=/opt/ssl \
--build-arg cryptoplayers=4 .
docker tag malicious-shamir-party.x:latest \
initc3/malicious-shamir-party.x:$(git log -n 1 --pretty=format:%h)
docker push initc3/malicious-shamir-party.x:$(git log -n 1 --pretty=format:%h)
docker build \
--tag mpspdz:random-shamir.x \
--target machine \
--build-arg machine=random-shamir.x \
--build-arg gfp_mod_sz=4 \
--build-arg prep_dir=/opt/inputmask-shares \
--build-arg ssl_dir=/opt/ssl \
--build-arg cryptoplayers=4 .
docker tag mpspdz:random-shamir.x:latest \
initc3/random-shamir.x:$(git log -n 1 --pretty=format:%h)
docker push initc3/random-shamir.x:$(git log -n 1 --pretty=format:%h)
docker build \
--tag mpspdz:mal-shamir-bmr \
--build-arg machine=mal-shamir-bmr-party.x \
--build-arg prep_dir=/opt/preprocessing-data \
--build-arg ssl_dir=/opt/ssl \
--build-arg cryptoplayers=3 \
--build-arg src=tutorial \
--build-arg compile_options="--binary=32" .
docker tag mpspdz:mal-shamir-bmr:latest \
initc3/mal-shamir-bmr:$(git log -n 1 --pretty=format:%h)
docker push initc3/mal-shamir-bmr:$(git log -n 1 --pretty=format:%h)
To test the image, locally built:
docker run --rm mpspdz:mal-shamir-bmr ./Scripts/mal-shamir-bmr.sh tutorial
or, to test a pre-built image, hosted on DockerHub:
docker run --rm initc3/mal-shamir-bmr ./Scripts/mal-shamir-bmr.sh tutorial