Giter Club home page Giter Club logo

blockchain-crypto-mpc's Introduction

IMPORTANT NOTE

As of September 1, 2021, this repository will be converted to read only and support will end.

Therefore, starting on September 1, 2021, the following changes will occur:

  1. Unbound will stop maintenance for this repo.
  2. Unbound will not release any future versions of this repo.
  3. Unbound will not provide any security updates or hotfixes (should an issue arise).
  4. Unbound will stop support for this repo.

This library was originally created to enable users to experiment with MPC functionality using a subset of the functionality provided in Unbound products.

Users are encouraged to explore the new Unbound CORE offerings found in the Unbound Security website.

1. Introduction to blockchain-crypto-mpc

blockchain-crypto-mpc is an open source library released by Unbound Security that provides the cryptographic foundation to resolve one of the hardest challenges associated with crypto asset and blockchain applications: The protection of cryptographic signing keys and seed secrets.

Unbound leverages secure multiparty computation (MPC) for the protection and management of cryptographic keys and secrets, and provides industry-grade MPC-based solutions for key management, key protection and additional applications. The protocols were designed by Prof. Yehuda Lindell and Dr. Samuel Ranellucci, who also reviewed and approved the code and the implementation.

See the Unbound Cryptocurrency Wallet Library White Paper for more detailed information about the protocols.

This readme includes an overview of this library, why it is important, what it allows you to achieve, sample use cases, and how to use the library (high level description).

2. Who Should Use it?

Blockchain Crypto MPC provides 100% of the cryptography needed for strongly securing crypto asset and blockchain wallets -- while being as or more secure than dedicated cryptographic hardware -- for free. If you're developing a wallet or a platform for custody/exchanging of crypto assets -- you're in the right place!

Leveraging MPC for the protection of cryptographic keys and secrets, blockchain-crypto-mpc provides the security benefits of no single point of compromise and shared responsibility (like Multi-Sig), but with a single signature and without any dependency on the ledger. More specifically, it provides three critical security properties:

  1. Sensitive keys and secrets are split into two random shares, which are stored on separate, segregated machines ('machine' stands for any computing device). Each of these shares by itself reveals nothing whatsoever about the key material.

  2. All cryptographic operations performed throughout the key lifecycle are performed without ever combining these 2 shares together. This includes signing, derivation and even generation. Bottom line -- there is no complete key material or secret in the memory, ever. It is proven mathematically that obtaining the key material requires access to both key shares, and therefore requires compromising both machines. A single machine, even if completely compromised and controlled by an attacker, reveals nothing about the key material -- simply because the key material never resides in any single machine.

  3. Key shares refresh: The key shares are continually modified without modifying the key itself. It is computationally efficient and can be performed very frequently -- thus forcing the attacker to compromise both machines at virtually the same time in order to obtain key material.

Key Shares

blockchain-crypto-mpc includes a secure MPC implementation of 100% of the functionality required to strongly secure crypto asset and blockchain wallets. It's pure software, open-source and free to use.

It is highly recommended for developers of wallets and blockchain applications that deal with key management.

We are delighted to make this contribution to the open source community, with hopes that it will enable secure, convenient, and easy to use blockchain applications for all.

3. What's Included?

blockchain-crypto-mpc includes a secure MPC implementation of the following algorithms:

  • 2-party ECDSA secp256k1: generation and signing
  • 2-party EdDSA ed25519: generation and signing
  • 2-party BIP32 (based on the BIP32 specification): generation, hard derivation, and normal derivation
  • Key share refresh
  • Zero-knowledge backup

The source code is written in C++ and the external API in C. Detailed documentation including a whitepaper and security proofs will be available online soon.

It can be compiled on virtually any platform. The only dependency is OpenSSL, which is available on most platforms. Instructions on how to remove this dependency will be included in future documentation.

The compiled binary is a cryptographic library that has to be deployed on two or more separate machines to provide strong security.

4. What are the Typical Use Cases?

blockchain-crypto-mpc can be used to provide security in any blockchain app. In this section we describe typical use cases that are relevant to many applications.

4.1 Endpoint/Server Use Case

This use case is common for wallet service providers. The user has a mobile wallet on their endpoint device, typically their mobile phone or laptop. The wallet application communicates with a server application.

4.1.1 Suggested setup:

The BIP32 seed and all signing keys are always split between the end user's device (participant 1) and the service provider (participant 2). Performing any cryptographic operation on the seed or private key requires cooperation of both participants (and communication between them).

Endpoint/Server Use Case

4.1.2 Use Case Properties

  • Guaranteed non-repudiation; the application server cannot sign any transaction without cooperation from the endpoint device.
  • No single point of compromise: Compromising the seed or key material requires the attacker to compromise both the server and the endpoint simultaneously.
  • No key or seed material ever appears in the clear throughout its lifecycle, including while in use and during generation.
  • Resilient to side-channel attacks.
  • A model that empowers a crypto service provider to create an excellent user experience by delivering a wallet service while maintaining a very high security level and granting the users full control of their crypto assets.

4.2 Mobile/Laptop Use Case

This is a use case involving two end-user devices that typically belong to the same user. For example, a mobile phone and a laptop. Each device runs an app and both participants collaborate to create a secure blockchain wallet and sign transactions.

4.2.1 Suggested Setup

The BIP32 seed and all signing keys are always split between the mobile device (participant 1) and the laptop (participant 2). Performing any cryptographic operation on the seed or private key requires cooperation of both participants (and communication between them).

Mobile/Laptop Use Case

4.2.2 Use Case Properties

  • Both devices must collaborate and approve any transaction. No single device can approve a transaction.
  • No single point of compromise: Compromising the seed or key material requires the attacker to compromise both the laptop and the mobile device simultaneously.
  • No key or seed material ever appears in the clear throughout its lifecycle, including while in use and during generation.
  • Resilient to side-channel attacks.
  • A model that empowers a wallet provider to create an excellent user experience while maintaining a very high security level and granting the users full control of their crypto assets.

4.3 Backup

Backup is one of the most challenging aspects of crypto asset key management. This section briefly describes the backup functionality of blockchain-crypto-mpc and two potential usage scenarios.

blockchain-crypto-mpc includes a unique backup mechanism that introduces zero-knowledge backup: an encrypted cold backup that allows public verifiability. This property is significant, as it allows both participants to verify the correctness of the backup at any point in time without decrypting it. It therefore makes this verification secure and prevents a situation where a wrong backup was generated and stored.

4.3.1 Backup Use Case 1: User-Managed

This is a common form of backup, with the role of backup management mostly on the end-user. An encrypted backup of the wallet can be stored in multiple locations for redundancy (for example, it can be stored by the service provider as described in the Endpoint/Server use case). The private key for this backup should be in the user's sole possession, preferably in a cold backup. The backup recovery process should be used only for disaster recovery.

4.3.2 Backup Use Case 2: Managed Backup

The following scenario is an expansion of the Endpoint/Server use case that includes a 3rd party trustee service. The trustee service is used only when either the user's device and/or the service provider have lost their respective key shares.

Backup Use Case 2: Managed Backup

This model creates a user-transparent backup, effectively similar to a 2-of-3 scenario: each quorum containing 2 of the 3 participants noted above would suffice to perform a cryptographic operation. This is performed by creating three different random share pairs upon wallet and seed generation. In the diagram, key share A is used by the user's device and the Trustee Service, key share B is used by the user's device and the Wallet Service Provider, and key share C is used by the Wallet Service Provider and the Trustee Service. It's important to highlight that each of these pairs is completely independent, each is effectively a backup of the same seed.

5. Benchmarking and Performance

This repository includes a two different tools for benchmarking the blockchain-crypto-mpc library.

  1. MPC Crypto Bench - a tool written C++. See mpc_crypto_bench in the bench folder for more information.
  2. MPC Crypto Python script. See mpc_crypto in the Python folder for more information.

MPC Crypto Bench tests the raw protocols, with no networking involved, while the MPC Crypto Python script is uses a client and server with actual networking.

Using the Python script, each command was run for 20 iterations and resulted in the following performance numbers:

Algorithm Command Time (seconds)
ECDSA Generate 0.945
ECDSA Sign 0.015
EdDSA Generate 0.003
EdDSA Sign 0.003

The tests were run on a server with an Intel Xeon E5-2686 v4 (2.30 GHz) with 32 GB RAM.

6. Technical Overview and Usage Guidelines

Unbound's Blockchain Crypto MPC open source library provides functions that enable you to create, sign, and refresh encryption keys, without the whole key ever existing in any location.

This library can be used to create system with two peers for the management of the keys. Each peer uses the library to create and process messages that are sent between the peers. Note that the actual communication between peers is not included in this library.

blockchain-crypto-mpc system

6.1 Definitions

Blockchain Crypto MPC utilizes the following three structures:

  1. Key share -- Encryption keys never exist as complete keys in any phase of the process or in any location at any time. A key share is a piece of a key, which can be used by Unbound's MPC technology to sign transactions.
  2. Message -- Data that is passed to the other peer. The message contains information about the action in progress.
  3. Context -- Since each action, such as signing with a key, involves multiple messages between the two peers, the status of the action is preserved in a context.

The key share, message, and context contain varying amounts of information depending on the type action, and therefore they are structures.

6.2 Actions

The library provides the following actions:

  • 2-party ECDSA secp256k1: generation and signing
  • 2-party EdDSA ed25519: generation and signing
  • 2-party BIP32 (based on the BIP32 specification): generation, hard derivation, and normal derivation
  • Key share refresh
  • Zero-knowledge backup

The library also provides mechanisms to handle serialization, deserialization, and memory management for the key share, message, and context structures.

6.3 System Flow

The system flow is shown in the following figure:

Flow

The first step is initialization. During this step you provide the library with all the relevant information required to complete the desired action. This step takes that information and creates a context. Each peer does its own initialization.

The context is then passed through a series of steps. Each of these steps takes an input message, does some manipulation, and then creates an output message. You then transfer this output message to the other peer. The other peer receives the message and associates it with a context. It then knows how to handle the incoming message based on the context.

When the peer is done with the last step it sets a finished flag. The peer can then do any necessary cleanup, such as freeing memory, or copying an updated key share to storage.

6.3.1 Peer Roles

Peer roles are determined by which peer initiates key generation. This peer must be used for any subsequent key operations, such as signing, derivation, and backup. For example, if peer A generates a key and then peer B wants to initiate a signing process, it should make a request to the peer A to start the process. When complete, the peer A can send the result to peer B. Peer B can verify this result with the verify function.

6.3.2 Detailed Flow

A detailed flow is described in the following procedure:

  1. Peer A calls the relevant initialization function.
  2. Peer A calls the step function, with a null input message, and gets an output message.
  3. Peer A sends the operation details and its output message to peer B.
    • Note that the operation details are sent in this step. This information enables peer B to run the initialization function. Alternatively, this information can be sent any time before the next step.
  4. Peer B verifies the operation details and consents to execute it.
  5. Peer B calls the initialization function.
  6. Peer B calls the step function with the message it received from peer A as input message.
  7. Peer B sends the output message back to peer A.
  8. Each peer alternates calling the step function with the input message from the other peer and then sending the output message to the other peer.
  9. This ping-pong process continues until both peers are finished, which is determined by output flags from the step function.
    • The mpc_protocol_finished flag denotes that it was the last step on this peer.
    • If it also includes the mpc_share_changed flag then the local key share changed, such as with a refresh action. The key share needs to retrieved from the context using the getShare function and stored for future use.
    • If the output message from the last step is not empty it must be sent to the other peer.
    • One or both peers may need to call the getResult function based on the type of operation. For example, a sign action only has a result for one peer, but a refresh action has a new key share for both peers.

Throughout the entire process the same context should be used. If the context needs to be stored, you can use the serialization function, and then read it back in using the deserialization function.

6.3.3 Example Action

An example of an ECDSA signing action is shown in the following figure.

Flow

Each peer starts by calling the MPCCrypto_initEcdsaSign() function for initialization. After initialization, each peer calls the MPCCrypto_step() function a number of times until the peer is finished with the signing process. The signature, which is the result of the signing process, is received by calling the final function, MPCCrypto_finalEcdsaSign(), after which the signing process is done.

blockchain-crypto-mpc's People

Contributors

peer-guy avatar philamericus avatar tovad avatar valery-osheter avatar westernicelander avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blockchain-crypto-mpc's Issues

2-party BIP32

Hi,
Recently have read the white paper of the blockchain-crypto-mpc library, but I still confused about that how to use BIP-Key-Derivation to output the shared private keys x1 and x2 of wallet private keys x. How to split the BIP32 seed and get the shared private keys x1 and x2 of wallet private keys x via 2-party BIP32 .I want to know hou to implementation 2-party BIP32 of the library? Looking forward to your reply, thanks

Retrieving Public Key from ECDSA Key Share

Hi,

I've followed the instructions posted at #8 and can successfully run the python demo, so thank you for posting them. However, I'm trying to figure out what the public key is from one of the derived key shares. I can see that there is a function named getPublic() which I have called. This returns me the following data if I do a print:

b'0V0\x10\x06\x07*\x86H\xce=\x02\x01\x06\x05+\x81\x04\x00\n\x03B\x00\x04\x18\xe1Dn)\xa9G\xc6\xf3\x8b\xd1\xa2"\xfc]\xb0!\xe1Y\xd3\xcd\x8b\t!S\x17\x81\xe0O\xd1\x1a\xc9vA\xb1\xc4^\xb4\x93\x9f|\xf0\x1at\x85r\xc3\xd4\x95'\xc8u\x0e\x84\x83\n\xf0\x0f\xfa\xf1\xf0\xdc\x16\xc9'

If I call .encode("hex") on this data I get:

'3056301006072a8648ce3d020106052b8104000a0342000418e1446e29a947c6f38bd1a222fc5db021e159d3cd8b0921531781e04fd11ac97641b1c45eb4939f7cf01a748572c3d49527c8750e84830af00ffaf1f0dc16c9'

Is what I'm doing correct? I've tried to use the public key to verify a signature generated from my keyshares using an online tool (https://kjur.github.io/jsrsasign/sample/sample-ecdsa.html) and it hasn't worked (which would suggest my public key is wrong)

Any help would be greatly appreciated.

Thanks,
Zeki

BIP32 Signing

Hi,

I am a bit fuzzled about standard signature hash lengths and deriving r and s values. When doing ECDSA signing with a derived BIP32 key, i get variant signature hash lengths, so far have observed 69,70 and 71 lengths......

length 69bytes:
b'0C\x02 \x15\x10\xf8D\xf2P\xe2j\xf7\x1d\xa9\x9a|\xe0\xbd\xcdh\x7f\xb5\xfdB&\xf6\x15H\x84\xb6\xc8pG\x1e\x85\x02\x1ff\xb4\x9c\x05\x13O\xa7\x7f\xde\xc0\x14\xdb&\xeb\x80\xacJ\x03\x1cnR\x9a\x99v\x11\x02\xbcb\xe8U\xf3'

length 70bytes:
b'0D\x02!\x00\xd3*\xfc\xdeT+h\xf5k[\xaa3\x13$r\x17\xd1\xdfe\n\x03\xde=Y\xb0\xc1@\x90*\x1a\xac\xc7\x02\x1f):D\xeb\x9b*\xe3:\xcf\xf7\x1a\xefL1%3\x1eN\x0b\xe5\x16\xaa\xb1\x00e\xff\x01\xdf\xdcv\x01'

length 71bytes:
b'0E\x02!\x00\xff\xf3>W\x94!\x03\xf6+i\xd6M\#\x8ag;\x96\x9a\xce7\xfa\x95\xf3\xf4@\x11\xccR\xaa\x011\x02s\x94\xbaH\xbb\x04q]T\n\x1f\x1bs!\xe4\x9c\xf2\x14C\x8a\xcd\xbdr\x7fwzR\xd2\x03;\xa7\x88'

.....which doesn't easily fit into the 70bytes to 73 bytes expectation, as follows, and how to get an RLP encoded signature.

6 byte | DER encoding overhead
32 byte | r-value
(1 byte) | r-value padding (if needed)
32 byte | S-value
(1 byte) | S-value padding (if needed)
1 byte | Signature Hash

Kindly clarify what I am missing.

Additionally, extracting the public key after a generate then derive BIP32 key steps still confusing to me, I get a 176byte output thereafter can't figure out what to do to derive an ethereum address, given that computing an address requires a 64byte public key.

Thank you for the library and the chance to research on mpc crypto operations on blockchains.

GPU cvms_element_build_from_source error on MBP 2018 (index 1, worksize 1, mining intensity 1000)

  • ABOUT XMRig-AMD/2.14.1 clang/10.0.0
  • LIBS libuv/1.26.0 OpenCL/1.2 microhttpd/0.9.63
  • CPU Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz x64 AES
  • ALGO cryptonight, donate=20%
  • POOL #1 gulf.moneroocean.stream:10002 variant=auto
  • API BIND 0.0.0.0:42096
  • COMMANDS 'h' hashrate, 'p' pause, 'r' resume
    [2019-11-10 19:39:12] compiling code and initializing GPUs. This will take a while...
    [2019-11-10 19:39:13] AMD GPU #1: intensity is not a multiple of 'worksize', auto reduce intensity to 0
    [2019-11-10 19:39:13] #00, GPU #1 (AMD Radeon Pro 560X Compute Engine), i:0 (100/256), si:2/2, u:8, cu:16
    [2019-11-10 19:39:13] 0.00/1.00/4 GB
    [2019-11-10 19:39:13] Error CL_INVALID_BUFFER_SIZE when calling clCreateBuffer to create hash scratchpads buffer.
    [2019-11-10 19:39:13] Failed to start threads.
    Stopped at 2019-11-10 18:39:57 +0000Stopped at 2019-11-10 18:40:05 +0000 * ABOUT XMRig-AMD/2.14.1 clang/10.0.0
  • LIBS libuv/1.26.0 OpenCL/1.2 microhttpd/0.9.63
  • CPU Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz x64 AES
  • ALGO cryptonight, donate=20%
  • POOL #1 gulf.moneroocean.stream:10002 variant=auto
  • API BIND 0.0.0.0:42096
  • COMMANDS 'h' hashrate, 'p' pause, 'r' resume
    [2019-11-10 19:40:06] compiling code and initializing GPUs. This will take a while...
    [2019-11-10 19:40:06] Selected OpenCL device index 4 doesn't exist.
    [2019-11-10 19:40:06] Failed to start threads.
    Stopped at 2019-11-10 18:40:23 +0000 * ABOUT XMRig-AMD/2.14.1 clang/10.0.0
  • LIBS libuv/1.26.0 OpenCL/1.2 microhttpd/0.9.63
  • CPU Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz x64 AES
  • ALGO cryptonight, donate=20%
  • POOL #1 gulf.moneroocean.stream:10002 variant=auto
  • API BIND 0.0.0.0:42096
  • COMMANDS 'h' hashrate, 'p' pause, 'r' resume
    [2019-11-10 19:40:28] compiling code and initializing GPUs. This will take a while...
    [2019-11-10 19:40:28] Selected OpenCL device index 2 doesn't exist.
    [2019-11-10 19:40:28] Failed to start threads.
    Stopped at 2019-11-10 18:40:46 +0000 * ABOUT XMRig-AMD/2.14.1 clang/10.0.0
  • LIBS libuv/1.26.0 OpenCL/1.2 microhttpd/0.9.63
  • CPU Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz x64 AES
  • ALGO cryptonight, donate=20%
  • POOL #1 gulf.moneroocean.stream:10002 variant=auto
  • API BIND 0.0.0.0:42096
  • COMMANDS 'h' hashrate, 'p' pause, 'r' resume
    [2019-11-10 19:40:50] compiling code and initializing GPUs. This will take a while...
    [2019-11-10 19:40:50] AMD GPU #1: intensity is not a multiple of 'worksize', auto reduce intensity to 0
    [2019-11-10 19:40:50] #00, GPU #1 (AMD Radeon Pro 560X Compute Engine), i:0 (100/256), si:2/2, u:8, cu:16
    [2019-11-10 19:40:50] 0.00/1.00/4 GB
    [2019-11-10 19:40:51] Error CL_INVALID_BUFFER_SIZE when calling clCreateBuffer to create hash scratchpads buffer.
    [2019-11-10 19:40:51] Failed to start threads.
    Stopped at 2019-11-10 18:41:30 +0000 * ABOUT XMRig-AMD/2.14.1 clang/10.0.0
  • LIBS libuv/1.26.0 OpenCL/1.2 microhttpd/0.9.63
  • CPU Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz x64 AES
  • ALGO cryptonight, donate=20%
  • POOL #1 gulf.moneroocean.stream:10002 variant=auto
  • API BIND 0.0.0.0:42096
  • COMMANDS 'h' hashrate, 'p' pause, 'r' resume
    [2019-11-10 19:41:34] compiling code and initializing GPUs. This will take a while...
    [2019-11-10 19:41:34] #00, GPU #1 (AMD Radeon Pro 560X Compute Engine), i:1 (1/256), si:2/2, u:8, cu:16
    [2019-11-10 19:41:34] 0.00/1.00/4 GB
    [2019-11-10 19:41:34] GPU #1 compiling...
    [2019-11-10 19:41:51] Error CL_BUILD_PROGRAM_FAILURE when calling clBuildProgram.
    [2019-11-10 19:41:51] Failed to start threads.
    Build log:
    Error returned by cvms_element_build_from_sou

Radeon Pro 560X:

Chipset Model: Radeon Pro 560X
Type: GPU
Bus: PCIe
PCIe Lane Width: x8
VRAM (Total): 4 GB
Vendor: AMD (0x1002)
Device ID: 0x67ef
Revision ID: 0x00c2
ROM Revision: 113-C980AL-075
VBIOS Version: 113-C97501U-005
EFI Driver Version: 01.01.075
Automatic Graphics Switching: Supported
gMux Version: 5.0.0
Metal: Supported, feature set macOS GPUFamily2 v1
Displays:
Color LCD:
Display Type: Built-In Retina LCD
Resolution: 2880 x 1800 Retina
Framebuffer Depth: 24-Bit Color (ARGB8888)
Main Display: Yes
Mirror: Off
Online: Yes
Automatically Adjust Brightness: No
Connection Type: Internal

Build problem and wasm)

Hi, i need help for building lib

I apologize in advance for the stupid questions, I am not strong in c ++
i use directions for build of the build.md and i get an error

c++ -O2 -fPIC -fno-strict-aliasing -Wno-unused -Wno-switch -Wno-switch-enum -Werror -mpclmul -std=c++0x -DMPC_CRYPTO_NO_JNI -DMPC_CRYPTO_EXPORTS -fvisibility=hidden -maes -I include -I /include -I /include/linux -I src/utils -I src/crypto_utils -I src/mpc_protocols -o src/utils/precompiled.h.gch -c src/utils/precompiled.h
clang: error: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]
make: *** [src/utils/precompiled.h.gch] Error 1

Has anyone come across this?

And second question)

i can compile this library into wasm?
i try compile but i always get errors because at first i need compile this lib

I would like to know right away whether to spend the effort or is it unrealistic, like some libraries on Rust

my platform macos

serialize and deserialized of the context

I tried to serialize the context to a file, and the share obtained by the deserialized context could not execute the toBuf function. A memory error will be reported as soon as it is executed.

clang: error: no such file or directory: 'libmpc_crypto.so'

Hi all. make command fails at the libmpc_crypto.so step with the following error. What could be the issue here?

g++ -o -v libmpc_crypto.so src/mpc_crypto_context.o src/mpc_crypto_ec_backup.o src/mpc_crypto_ecdsa.o src/mpc_crypto_ecdsa_bip.o src/mpc_crypto_eddsa.o src/mpc_crypto_generic_secret.o src/mpc_crypto_jni.o src/mpc_crypto_message.o src/mpc_crypto_share.o src/mpc_crypto_test.o src/utils/precompiled.o src/utils/ub_buf.o src/utils/ub_buf128.o src/utils/ub_buf256.o src/utils/ub_common.o src/utils/ub_convert.o src/utils/ub_cpuid.o src/utils/ub_error.o src/utils/ub_string.o src/utils/ub_thread.o src/crypto_utils/crypto.o src/crypto_utils/crypto_aesni.o src/crypto_utils/crypto_bn.o src/crypto_utils/crypto_ecc.o src/crypto_utils/crypto_ecc_bip.o src/crypto_utils/crypto_hash.o src/crypto_utils/crypto_oaep.o src/crypto_utils/crypto_paillier.o src/crypto_utils/crypto_rsa.o src/crypto_utils/ec25519_core.o src/crypto_utils/small_primes.o src/mpc_protocols/circuit_data.o src/mpc_protocols/ecc_backup.o src/mpc_protocols/garbled_circuit.o src/mpc_protocols/garbled_circuit_2party.o src/mpc_protocols/mpc_core.o src/mpc_protocols/mpc_ecc_core.o src/mpc_protocols/mpc_ecdsa.o src/mpc_protocols/mpc_eddsa.o src/mpc_protocols/mpc_ot.o src/mpc_protocols/garbled_circuit_x64.o -s -Wl,-z,defs -Wl,-rpath,\'\$ORIGIN\' -shared -rdynamic -lcrypto -lpthread

clang: error: no such file or directory: 'libmpc_crypto.so'

Some details about my machine and clang version I use.

Apple clang version 13.0.0 (clang-1300.0.27.3)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

some observations on Share Refresh

Hi,

Referring to ecdsa Share Refresh as described in text https://github.com/unbound-tech/blockchain-crypto-mpc/blob/master/docs/Unbound_Cryptocurrency_Wallet_Library_White_Paper.md#56-share-refresh and in code https://github.com/unbound-tech/blockchain-crypto-mpc/blob/74a4864b940e74f4da9858bf6b51202bb6ee2a7a/src/mpc_protocols/mpc_ecdsa.cpp#L473

  1. Since a new Paillier key pair is generated, I think that a zk proof that the Paillier public key was generated correctly is needed (same as in Key Generation).
  2. It is important to note that the new value encrypted under pailliler is not the same value as the private key because of the modulo operation. I.e. for Alice the private key is x1' = x1 + r mod q and the paillier encryption is for x1 + r. Theoretically after many rotations some bits could be leaked but in practice this is a very big number. Since in signing r part of the encryptions cancel out the difference between the private key and its encryption does not matter much.

getting the same share for both parties with the python mpc script

I followed the comments in mpc_demo.py to test key generation. The example is as follows.
Example 1: Generate a split EDDSA key
user1@host1> python mpc_demo.py --out_file key_share.bin --server
user2@host2> python mpc_demo.py --type EDDSA --command generate --out_file key_share.bin --host host1

I ran them both on the same machine, but in two different sessions kinda like this:
user1@host1> python mpc_demo.py --out_file key_share1.bin --server
user1@host1> python mpc_demo.py --type EDDSA --command generate --out_file key_share2.bin --host localhost

but key_share1 and key_share2 are identitcal.
What's happening? Is it because it runs on the same machine? Or did I misunderstood something else?

External API and documentation

In the README file it is stated that documentation will be available soon, and indeed, I didn't find the documentation, only the white paper, which is very valuable, but doesn't seem to include documentation of the library API itself. Also, I didn't find the API in C, only the source in c++. Considering that the library is said to be no longer maintained, will be able to see those things in the future?

mpc_crypto.restoreEddsaKey() return wrong eddsa private key

Refer to tests.py, function eddsa_backup()
we do step
1 backup key
2 verify backup with function mpc_crypto.verifyEddsaBackupKey()
3 restore key from backup with function mpc_crypto.restoreEddsaKey()
we get eddsa private key and public key at this point

I do some test if eddsa private key is corresponds to public key.
I import the eddsa private key to create pynacl's private key
and retrieve public key from pynacl's private key.

I expect public key retrieved from pynacl's private key should equal to public key from function eddsa_backup() but they are not equal.

My test code is here (the code is adapted from tests.py)
https://drive.google.com/file/d/18Op3KwMywbw3sMMbO1NQJcW5HvwxOxsm/view

Anyway, I have learned a lot from your work.
Thanks you so much.

Best regards,
Phanu C.

JNI ERROR

Hi I'm trying to build the project but I got a problem about "jni error" I already define JAVA_HOME environment variable.Also I can find jni.h. I'm using ubuntu linux. I want to solve my problem Could you please help me
image
image
image

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.