MPC Core
The MPC Core is a library that simplifies interactions with the precompiled contracts which provide core functionalities for secure multi-party computation (MPC) using the COTI protocol.
Usage
Types
Inputtext
Garbledtext
Ciphertext
Usertext
Functions
Since private data types mostly support the same functions, we have chosen to list only the functions pertaining to the itUint64, gtUint64 and ctUint64 types. See MpcCore.sol for the full list of supported functions.
Special Functions
Retrieves the user's AES encryption key in encrypted format, by using the provided RSA public key to encrypt it.
A valid signature using the EOA private key is used to validate the account ownership.
Removes the user's AES encryption key from the system.
Verifies that a given inputtext has a valid signature and onboards it into the gcEVM, returning a Garbledtext™ value.
If the input is not valid, the call will revert with no return data and no additional gas will be consumed.
The function onboards a given Ciphertext to the gcEVM, resulting in a Garbledtext™ value.
Must be invoked with ciphertext encrypted by the system AES key, such as ciphertexts that are generated by calling
offboard
.
The function offboards the given Garbledtext™ from the gcEVM, resulting in a Ciphertext.
The offboarding process uses the network AES key to encrypt the value inside the Garbledtext™.
The function offboards the given Garbledtext™ from the gcEVM, resulting in a Ciphertext.
The offboarding process uses the user AES key associated with the given address to encrypt the value inside the Garbledtext™.
The function offboards the given Garbledtext™ from the gcEVM, resulting in a struct containing two Ciphertexts.
The offboarding process uses both the network AES key and the user AES key associated with the given address to encrypt the value inside the Garbledtext™.
Returns the clear value of the given Ciphertext.
Onboards the given clear input to the gcEVM, resulting in a Garbledtext™.
Generates an encrypted random value in Garbledtext™ form.
Generates an encrypted random value that falls within the range of [0, 2^numBits] in Garbledtext™ form.
Returns the encrypted balances of two accounts (one starting with balance
a
, the other starting with balanceb
) as a result of transferringamount
from the account with balancea
to the account with balanceb
, along with an encrypted boolean value indicating whether the transfer would succeed.If
a
is less thanamount
, then the resulting values ofa
andb
will remain unchanged.
Returns the encrypted balances of two accounts (one starting with balance
a
, the other starting with balanceb
) as a result of transferringamount
with allowanceallowance
from the account with balancea
to the account with balanceb
, along with an encrypted boolean value indicating whether the transfer would succeed.If
a
is less thanamount
or ifamount
is greater thanallowance
, then the resulting values ofa
andb
will remain unchanged.
Arithmetic Functions
Returns an encrypted value (either
a
orb
) based on the encrypted boolean inputIf
bit
is false, then the returned value is equal toa
If
bit
is true, then the returned value is equal tob
Enums
Represent different MPC data types
Represent different argument types
Encoding Functions
Combines an
MPC_TYPE
andARGS
into abytes2
value.
Combines two
MPC_TYPE
values and anARGS
value into abytes3
value.
Combines three
MPC_TYPE
values and anARGS
value into abytes4
value.
Combines four
MPC_TYPE
values and anARGS
value into abytes4
value.
Last updated