diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f74e8a04 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM rustlang/rust:nightly as build +WORKDIR multi-party-ecdsa +COPY ./ ./ +RUN cargo build --release --examples + +FROM ubuntu:18.04 +WORKDIR multi-party-ecdsa +COPY --from=build /multi-party-ecdsa/target/release/examples/sm_manager . +COPY --from=build /multi-party-ecdsa/target/release/examples/gg18_keygen_client . +COPY --from=build /multi-party-ecdsa/target/release/examples/gg18_sign_client . + +EXPOSE 8001 \ No newline at end of file diff --git a/demo/docker_demo.sh b/demo/docker_demo.sh new file mode 100755 index 00000000..6e66361a --- /dev/null +++ b/demo/docker_demo.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# build dokcer image if not built before +# docker build . -t=multi-party-ecdsa + +mkdir -p ~/KZen-networks/multi-party-ecdsa/temp/ +sudo cp Rocket.toml ~/KZen-networks/multi-party-ecdsa/temp/ +sudo cp params ~/KZen-networks/multi-party-ecdsa/temp/ +sudo cp demo/run_in_docker.sh ~/KZen-networks/multi-party-ecdsa/temp/ + +docker-compose up \ No newline at end of file diff --git a/demo/run_in_docker.sh b/demo/run_in_docker.sh new file mode 100755 index 00000000..be0c60b6 --- /dev/null +++ b/demo/run_in_docker.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +n=`cat params | sed -n 1p` +t=`cat params | sed -n 2p` +params="{\"parties\":\"$n\", \"threshold\":\"$t\"}" + +echo "Params: $params" +echo -n $params > params.json +echo "$0: Multi-party ECDSA parties:$n threshold:$t" +sleep 1 + +./sm_manager & + +sleep 2 +echo "keygen part" + +for i in $(seq 1 $n) +do + echo "key gen for client $i out of $n" + ./gg18_keygen_client http://0.0.0.0:8001 keys$i.store & + sleep 3 +done + + + +sleep 5 +echo "sign" + +for i in $(seq 1 $((t+1))); +do + echo "signing for client $i out of $((t+1))" + ./gg18_sign_client http://0.0.0.0:8001 keys$i.store "KZen Networks" & + sleep 3 +done diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..2e498410 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + multi-party-ecdsa: + image: multi-party-ecdsa + container_name: multi-party-ecdsa + command: bash -c "cp /multi-party-ecdsa/temp/Rocket.toml . && + cp /multi-party-ecdsa/temp/params . && + cp /multi-party-ecdsa/temp/run_in_docker.sh . && + ./run_in_docker.sh" + volumes: + - ~/KZen-networks/multi-party-ecdsa/temp/:/multi-party-ecdsa/temp/