ZenGo-X / multi-party-ecdsa

Rust implementation of {t,n}-threshold ECDSA (elliptic curve digital signature algorithm).
GNU General Public License v3.0
975 stars 308 forks source link

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

Open HAOYUatHZ opened 4 years ago

HAOYUatHZ commented 4 years ago

This Dockerfile compiles examples/sm_manager.rs, examples/gg18_keygen_client.rs & examples/gg18_sign_client.rs, and build an docker image for cross-platform use.

gbenattar commented 4 years ago

Can you edit the title and the description before we can merge this PR?

Ideally we would like more details on what this DockerFile will do if we run it. Thanks!

HAOYUatHZ commented 4 years ago

Can you edit the title and the description before we can merge this PR?

Ideally we would like more details on what this DockerFile will do if we run it. Thanks!

Hi Gary, I have improved the titles and descriptions in both https://github.com/KZen-networks/multi-party-ecdsa/pull/87 and https://github.com/KZen-networks/multi-party-ecdsa/pull/88

Please take a look, thanks!

gbenattar commented 4 years ago

@omershlo You can squash and merge (make sure to select this option).

omershlo commented 4 years ago

@HAOYUatHZ how do I test it on my computer?

HAOYUatHZ commented 4 years ago

@omershlo for now u can try it this way

mkdir ~/temp
cp params.json ~/temp/
cp Rocket.toml ~/temp/

docker run -p 8001:8001 -v ~/temp:/multi-party-ecdsa/temp -e ROCKET_ENV=development -it multi-party-ecdsa

once entering the container, run

cp ./temp/* .
./sm_manager

then open another window, run this script

n=`cat params | sed -n 1p`
t=`cat params | sed -n 2p`

rm keys?.store
killall sm_manager gg18_keygen_client gg18_sign_client 2> /dev/null

for i in $(seq 1 $n)
do
    echo "key gen for client $i out of $n"
    ./target/release/examples/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))"
    ./target/release/examples/gg18_sign_client http://0.0.0.0:8001 keys$i.store "KZen Networks" &
    sleep 3
done

Note that this only runs sm_manager inside docker but not keygen_client and sign_client. So this only proves the docker image building & communication (address binding) are correct.

I will write a better run.sh to get all binaries running in dockers.

omershlo commented 4 years ago

is there a way to get "1 click" solution? l

HAOYUatHZ commented 4 years ago

is there a way to get "1 click" solution? l

no problem. I will write a 'run.sh' for it.

HAOYUatHZ commented 4 years ago

@omershlo now you can run demo/docker_demo.sh in repo root directory

(But for the first time you will need to run docker build . -t=multi-party-ecdsa to build the image. This has been commented out in https://github.com/KZen-networks/multi-party-ecdsa/pull/88/files#diff-e023b047c4c5d3b9773f8bcf08e71535R4)