This project is an example usage of https://github.com/KZen-networks/multi-party-ecdsa library which is a Rust implementation of {t,n}-threshold ECDSA.
Includes support for HD keys (BIP32). HD support based on https://github.com/trepca/multi-party-ecdsa/tree/hd-support.
This branch also includes EdDSA based on https://github.com/ZenGo-X/multi-party-eddsa with an experimental support of HD keys.
-
Install Rust nightly (Rocket requires the latest version of Rust nightly).
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup default nightly
-
Clone & build.
git clone [email protected]:HRezaei/tss-ecdsa-cli.git cd tss-ecdsa-cli git checkout feature/chain-code-arg cargo build --release
-
Run state manager which is managing the communication between parties:
./target/release/tss_cli manager
To run on different host/port adjust Rocket.toml or override using env vars.
ROCKET_ADDRESS=127.0.0.1 ROCKET_PORT=8008 ./target/release/tss_cli manager
-
Run keygen:
USAGE: tss_cli keygen [OPTIONS] <keysfile> <params> OPTIONS: -a, --addr <manager_addr> URL to manager. E.g. http://127.0.0.2:8002 -l, --alg <algorithm> Either ecdsa (default) or eddsa ARGS: <keysfile> Target keys file <params> Threshold params: threshold/parties (t+1/n). E.g. 1/3 for 2 of 3 schema. # Run keygen for each party t=1 && n=3; for i in $(seq 1 $n) do echo "key gen for client $i out of $n" ./target/release/tss_cli keygen keys$i.store $t/$n & sleep 2 done
Output will return X and Y coordinates of a public key at specified path.
USAGE:
tss_cli pubkey [OPTIONS] <keysfile>
OPTIONS:
-p, --path <path> Derivation path
-l, --alg <algorithm> Either ecdsa (default) or eddsa
-c, --cc <chain_code> Hex representation of chain_code
ARGS:
<keysfile> Keys file
./target/release/tss_cli pubkey keys1.store
# Output: {"path":"","x":"20d6d63f5baa237c747c33dd85170e186d31fa2948b3bb4615e7d08045f05614","y":"6b4ae2e5a65f750f911e92f365f8f4733949f4681efb9ebfa8d9d8fec258e96"}
./target/release/tss_cli pubkey keys1.store -p 0/1/2
# Output: {"path":"0/1/2","x":"973dba2e6c622d0d62626b5cc20e9561dd6123afca96d7b811f637900e68d99e","y":"7c1b2d91cdbfd6e9ceab48dc94aedfd021e314f4d90d18cbb8a4b40d543f85cd"}
Run state manager and run as many signer parties as you configured when used keygen.
USAGE:
tss_cli sign [OPTIONS] <keysfile> <params> <message>
OPTIONS:
-a, --addr <manager_addr> URL to manager
-p, --path <path> Derivation path
-l, --alg <algorithm> Either ecdsa (default) or eddsa
-c, --cc <chain_code> Hex representation of chain_code
ARGS:
<keysfile> Keys file
<params> Threshold params: threshold/parties (t+1/n). E.g. 1/3 for 2 of 3 schema.
<message> Message to sign in hex format
./target/release/tss_cli sign keys1.store -p 0/1/2 -a http://127.0.0.1:8001 1/2 SignMe
./target/release/tss_cli sign keys2.store -p 0/1/2 -a http://127.0.0.1:8001 1/2 SignMe
# If all is correct, last line of the output should be json string, something like this:
{
"status":"signature_ready",
"r":"20863a51eb7b0e0fb95480ca7c11edef79bd08e40199f91821df02982f8e5af1",
"s":"ba8f2b6eff824796bf1812667642d9d65ec6d8dead09b7c2c157a6317947249",
"recid":0,
"x":"973dba2e6c622d0d62626b5cc20e9561dd6123afca96d7b811f637900e68d99e",
"y":"7c1b2d91cdbfd6e9ceab48dc94aedfd021e314f4d90d18cbb8a4b40d543f85cd"
}