Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add Dockerfile for keygen & signing example codes #88

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions demo/docker_demo.sh
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions demo/run_in_docker.sh
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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/