GithubHelp home page GithubHelp logo

chrisalmeida / silent-shard-dkls23-ll Goto Github PK

View Code? Open in Web Editor NEW

This project forked from silence-laboratories/silent-shard-dkls23-ll

0.0 0.0 0.0 132 KB

Multi-Party Threshold Signature Library for ECDSA

License: Other

Shell 1.07% Rust 94.84% TypeScript 4.10%

silent-shard-dkls23-ll's Introduction

Multi-Party-TSS (ECDSA-DKLs23)

Silent Shard uses Multiparty computation (MPC) and enables a set of parties that do not trust each other to jointly compute a secret signing key without being constructed in one place and an ECDSA signature over their secret key shards while not sharing them with any of the involved parties, removing single points of trust.

TSS consists of three stages:

  • Distributed Key Generation (DKG),
  • Distributed Signature Generation, and
  • Proactive Security with Key rotation/refresh.

These functions involve cryptographic computing at the participating nodes of the MPC quorum and exchanges of rounds of messages which ultimately lead to the generation of a valid signature at the requested node. These computing nodes can be any device with sufficient computational and memory capability, including but not limited to smartphones, server nodes, and edge devices. The basic philosophy behind Silent Shard remains that no single device holding the private key can be used to generate signatures and move digital assets. The private key is shared among multiple computing nodes so that no party has any information about the key. Then, in order to generate a signature, the threshold number of devices run a secure two-party computation protocol that generates the signature without revealing anything about the parties' key shares to each other. These devices may or may not be associated with the same person or organization and can be any form factor. Thus, one could use this to create a wallet, sharing the private key between one's mobile and one's laptop, between one's mobile and a VM in the cloud, and so on.

Protocol

  • Silent Shard is based on DKLs23 threshold signature scheme
  • Enabled by well-chosen correlation + simple new consistency check.
  • Blackbox use of UC 2-round 2P-MUL.
  • UC secure.

Disclaimer

  • The code does not handle network communication security.
  • The state struct per request has public and private fields.
  • Presignatures should be used only once.
  • Proper validating of messages per round is needed.

Crates

dksl23-ll

The library contains a small set of tests. Please look for usual Rust tests in src/dkg.rs and src/dsg.rs

Εxamples (local unit tests with no communication)

  • Distributed Key Generation cargo test dkg::dkg2_out_of_2// 2 parties and t=2 cargo test dkg::dkg2_out_of_3// 3 parties and t=2

  • Distributed Signatures: cargo test dsg::sign_2_out_of_2 cargo test dsg::sign_2_out_of_3

  • Compute presignature only: Run the dsg::sign_2_out_of_* without the last round:

    let mut rng = rand::thread_rng();
    let chain_path = DerivationPath::from_str("m").unwrap();
        let mut parties = dkg(ranks, t)
            .into_iter()
            .take(t as usize)
            .map(|s| State::new(&mut rng, s, &chain_path).unwrap())
            .collect::<Vec<_>>();
    
        let msg1: Vec<SignMsg1> =
            parties.iter_mut().map(|p| p.generate_msg1()).collect();
    
        check_serde(&msg1);
    
        let msg2 = parties.iter_mut().fold(vec![], |mut msg2, party| {
            let batch: Vec<SignMsg1> = msg1
                .iter()
                .filter(|msg| msg.from_id != party.keyshare.party_id)
                .cloned()
                .collect();
            msg2.extend(party.handle_msg1(&mut rng, batch).unwrap());
            msg2
        });
    
        check_serde(&msg2);
    
        let msg3 = parties.iter_mut().fold(vec![], |mut msg3, party| {
            let batch: Vec<SignMsg2> = msg2
                .iter()
                .filter(|msg| msg.from_id != party.keyshare.party_id)
                .cloned()
                .collect();
            msg3.extend(party.handle_msg2(&mut rng, batch).unwrap());
            msg3
        });
    
        check_serde(&msg3);
    
        let pre_signs = parties
            .iter_mut()
            .map(|party| {
                let batch: Vec<SignMsg3> = msg3
                    .iter()
                    .filter(|msg| msg.from_id != party.keyshare.party_id)
                    .cloned()
                    .collect();
    
                party.handle_msg3(batch).unwrap()
            })
            .collect::<Vec<_>>();
    
        check_serde(&pre_signs);
    
        let hash = [255; 32];
    
        let (partials, msg4): (Vec<_>, Vec<_>) = pre_signs
            .into_iter()
            .map(|pre| create_partial_signature(pre, hash))
            .unzip();
    

dkls-wasm-ll

WASM bindings for dkls23-ll.

Build:

Install wasm-pack:

curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

wasm-pack build -t web wrapper/wasm-ll

Tests:

To run the test install deno:

curl -fsSL https://deno.land/install.sh | sh

deno test -A wrapper/wasm-ll/tests/tests.ts

Articles and links

silent-shard-dkls23-ll's People

Contributors

left-arm avatar leontiad avatar github-actions[bot] avatar sushisilence avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.