{"id":24141808,"url":"https://github.com/coinfabrik/wasm-multi-party-ecdsa","last_synced_at":"2025-09-19T11:30:52.575Z","repository":{"id":92566806,"uuid":"606165647","full_name":"CoinFabrik/wasm-multi-party-ecdsa","owner":"CoinFabrik","description":"Full WASM Secure Threshold Signature ECDSA Library","archived":false,"fork":false,"pushed_at":"2023-08-06T02:59:48.000Z","size":168,"stargazers_count":36,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-10T04:54:49.780Z","etag":null,"topics":["ecdsa","mpc","rust","threshold","threshold-signature","webassembly"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CoinFabrik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-24T18:47:24.000Z","updated_at":"2025-05-12T01:44:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"263e2b18-e804-44b0-a793-6db9fa78e841","html_url":"https://github.com/CoinFabrik/wasm-multi-party-ecdsa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CoinFabrik/wasm-multi-party-ecdsa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoinFabrik%2Fwasm-multi-party-ecdsa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoinFabrik%2Fwasm-multi-party-ecdsa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoinFabrik%2Fwasm-multi-party-ecdsa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoinFabrik%2Fwasm-multi-party-ecdsa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoinFabrik","download_url":"https://codeload.github.com/CoinFabrik/wasm-multi-party-ecdsa/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoinFabrik%2Fwasm-multi-party-ecdsa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275927843,"owners_count":25554274,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecdsa","mpc","rust","threshold","threshold-signature","webassembly"],"created_at":"2025-01-12T04:49:11.029Z","updated_at":"2025-09-19T11:30:52.565Z","avatar_url":"https://github.com/CoinFabrik.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WASM Multi Party ECDSA\n\nThis library provides a secure implementation of the Elliptic Curve Digital Signature Algorithm (ECDSA) in WebAssembly (WASM) implemented entirely in Rust. It enables parties to securely generate keys and sign messages using a threshold scheme without revealing their private keys. This solution outperforms previous hybrid approaches and is the first pure-wasm MPC solution.\n\n[CoinFabrik](https://www.coinfabrik.com/) is the Web3 solutions company behind this implementation.\n\n## Usage\n\n### Installation\n\nIn order to use the library, you will need to install the following dependencies:\n\n```shell\nnpm install @mpc-framework/wasm-multi-party-ecdsa comlink\n```\n\n### Preparation\n\nAs this library needs a web worker to perform the calculations, you'll need to create a worker instance. You can do this by creating a file called `worker.ts` and adding the following code:\n\n```typescript\nimport init, { initThreadPool, MultiPartyEcdsa } from \"wasm-multi-party-ecdsa\";\nimport * as Comlink from \"comlink\";\n\nvoid (async function () {\n  // Needed for wasm-bindgen-rayon\n  await init();\n  await initThreadPool(1);\n\n  // In case we want to add a hook to listen when it's ready\n  self.postMessage({ ready: true });\n})();\n\nconst worker = { MultiPartyEcdsa };\nexport type IWorker = typeof worker;\n\nComlink.expose(worker);\n```\n\nWe'll be using [Comlink](https://github.com/GoogleChromeLabs/comlink) to communicate with the worker. This is a library that allows us to use web workers as if they were regular functions.\n\nFinally, a temporary hack is needed for the `crypto.getRandomValues()` function to work with our library. More information can be found [here](). This code must be added to the same file `worker.ts`:\n\n\u003c!-- TODO: check if it really must be added there --\u003e\n\n```typescript\nconst getRandomValues = crypto.getRandomValues;\ncrypto.getRandomValues = function \u003cT extends ArrayBufferView | null\u003e(array: T) {\n  const buffer = new Uint8Array(array as unknown as Uint8Array);\n  const value = getRandomValues.call(crypto, buffer);\n  (array as unknown as Uint8Array).set(value as unknown as Uint8Array);\n  return array;\n};\n```\n\nNow we're ready to start using the library.\n\n### Keygen\n\nUsing the library is pretty straightforward. First we'll need to understand the concepts of groups, sessions and parties.\n\n- **Groups** are a collection of parties that will hold a key. A group can be reused to generate multiple keys or sign multiple messages.\n\n- **Sessions** are subgroups created by members of a group with the sole purpose of generating a key or signing a message. A session should not be reused.\n\n- **Parties** are the members that will hold a key. Each party is identified by a unique number.\n\n\u003c!--  TODO: tell about the different notification messages available  --\u003e\n\nTo generate our first set of keys, we'll define the number of parties and the threshold. The threshold is the minimum number of parties that need to be present in order to sign a message, minus one. The number of parties is the amount of parties that will hold a key.\n\n\u003e E.g.: Given a threshold of 1 and a number of parties of 3, we need at least 2 parties to be present in order to sign a message.\n\nWe can start by instantiating the library and connecting it to our [MPC-Manager](https://github.com/coinfabrik/mpc-manager) instance:\n\n```typescript\nimport * as Comlink from \"comlink\";\nimport { IWorker } from \"./worker\";\n\n// We need to create a new worker instance and wrap it with Comlink\nconst innerWorker = new Worker(new URL(\"./worker.ts\", import.meta.url));\nconst worker = Comlink.wrap\u003cIWorker\u003e(innerWorker);\n\n// Then we can instantiate the library. At this point we'll be connected\n// to our manager.\nconst multiPartyEcdsa = await new worker.MultiPartyEcdsa(\"ws://localhost:8080\");\n```\n\nNow we can create a new group and session, which we'll use to generate a new key:\n\n```typescript\nconst NUMBER_OF_PARTIES = 3;\nconst THRESHOLD = 1;\n\nconst { group } = await multiPartyEcdsa.groupCreate(\n  NUMBER_OF_PARTIES,\n  THRESHOLD\n);\nconst { session } = await multiPartyEcdsa.sessionCreate(\n  group.id,\n  \"keygen\",\n  null\n);\nconst { partyNumber } = await multiPartyEcdsa.sessionSignup(\n  group.id,\n  session.id\n);\n```\n\n```typescript\n// And use it to create a new key\nconst { localKey, publicKey } = await multiPartyEcdsa.keygen(\n  group.id,\n  session.id,\n  partyNumber,\n  NUMBER_OF_PARTIES,\n  THRESHOLD\n);\n```\n\nIn the other clients:\n\n```typescript\n// ... rest of the code\nconst { group } = await multiPartyEcdsa.groupJoin(groupId);\nconst { session, partyNumber } = await multiPartyEcdsa.sessionSignup(\n  groupId,\n  sessionId\n);\nconst { localKey, publicKey } = await multiPartyEcdsa.keygen(\n  group.id,\n  session.id,\n  partyNumber,\n  NUMBER_OF_PARTIES,\n  THRESHOLD\n);\n```\n\nAnd that's it! You now have a new multi-party key that can be used to sign messages.\n\n### Signing\n\nIn order to sign a message, we'll need to create a new session:\n\n```typescript\n// ... rest of the code\nconst message = new Uint8Array([1, 2, 3]);\nconst parties = [1, 2];\n\nconst { session } = await multiPartyEcdsa.sessionCreate(\n  groupId,\n  \"sign\",\n  message\n);\n\n// In this case we don't need to sign up, as we already got a party number\n// assigned to us at the moment of the keygen.\nawait multiPartyEcdsa.sessionLogin(groupId, session.id, localKey.i);\nconst signature = await multiPartyEcdsa.sign(\n  groupId,\n  session.id,\n  localKey,\n  parties,\n  message\n);\n```\n\nIn the other clients we must only login to the created session and wait for the signature to be generated:\n\n```typescript\n// ... rest of the code\nconst parties = [1, 2];\n\nconst { session } = await multiPartyEcdsa.sessionLogin(\n  groupId,\n  sessionId,\n  localKey.i\n);\nconst signature = await multiPartyEcdsa.sign(\n  groupId,\n  session.id,\n  localKey,\n  parties,\n  message\n);\n```\n\nAnd that's it! You have now signed your first message with a multi party threshold scheme.\n\n## Contributing\n\nIf you'd like to contribute to the library, please open an issue or submit a pull request. We welcome any contributions, including bug fixes, feature requests, and documentation improvements.\n\n\n## Acknowledgments\n\nThis project is based on the following projects:\n\n- Rosario Gennaro and Steven Goldfeder - \"One Round Threshold ECDSA with Identifiable Abort\"(https://eprint.iacr.org/2020/540.pdf)\n- ZenGo-X Multi Party Ecdsa (https://github.com/ZenGo-X/multi-party-ecdsa)\n- LavaMoat TSS-Snap (https://github.com/LavaMoat/tss-snap)\n\n## License\n\nThis project is licensed under the MIT License. Please see the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinfabrik%2Fwasm-multi-party-ecdsa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinfabrik%2Fwasm-multi-party-ecdsa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinfabrik%2Fwasm-multi-party-ecdsa/lists"}