Supported Operations on Private Data Types
Secure operations are supported via our gcEVM extension, which is implemented through a set of precompiled contracts.
To introduce a new private datum into the gcEVM, the function should include an argument of type Inputtext
. Inside the function, you must call ValidateCiphertext
, which validates the input and returns a Garbledtext
if successful or an error otherwise. Note that values of type Garbledtext
can be used in secure computations, and can also be converted into a Ciphertext
type by calling Offboard
. Values of type Ciphertext
can be stored temporarily in memory or permanently as a state variable. Note that values of type Ciphertext
cannot be used for secure computations, and therefore must be converted back into a Garbledtext
type by calling Onboard
in order to perform additional secure computations on them.
List of Operations and Their Required Gas
Each operation within the network requires a specific amount of gas. It's important to note that the following gas allocations are intended to be proportional and serve as initial estimates. The final determination of gas requirements will be made at a later stage, taking into account various factors such as network performance, usage patterns, and protocol optimizations.
List of arithmetic operations supported using Garbledtext
and their required Gas units
And
12005
12040
12080
12160
12320
Or
12005
12042
12084
12169
12339
Xor
12000
12000
12001
12003
12006
Add
12037
12080
12167
12340
CheckedAdd
26252
26318
26407
26577
Sub
12080
12165
12337
12679
CheckedSub
26341
26403
26576
26917
Mul
12620
14571
22467
54233
CheckedMul
26859
28754
36684
68536
Div
12969
15960
28009
76377
Rem
12969
15960
28009
76377
Min
12010
12121
12249
12503
13012
Max
12010
12121
12249
12503
13012
Lt
12005
12080
12166
12337
12679
Gt
12010
12121
12249
12503
13012
Ge
12005
12080
12165
12337
12679
Le
12010
12122
12249
12503
13012
Eq
12000
12037
12079
12164
12334
12334
Ne
12000
12037
12079
12164
12334
12334
Not
12000
** Note that the gas units listed for the gtString type are for every 8 characters in the string. This is due to the way encrypted strings are represented in memory/storage.
Other Special Function and Their Required Gas units
A more detailed explanation on the functionality of these functions can be found in the MPC Core library.
SetPublic
12000
12000
12001
12003
12006
12006
Decrypt
12000
12000
12001
12003
12006
12006
Onboard
47039
47039
47039
47039
47039
47039
ValidateCiphertext
47039
47039
47039
47039
47039
47039
Offboard
47039
47040
47040
47042
47045
47045
OffboardToUser
47039
47040
47040
47042
47045
47045
Rand
6000
6000
6000
6000
6000
RandBoundedBits
6000
6000
6000
6000
6000
Mux
12005
12041
12083
12166
12332
Transfer
12201
12413
12837
13685
TransferWithAllowance
12301
12619
13255
14527
** Note that the gas units listed for the gtString type are for every 8 characters in the string. This is due to the way encrypted strings are represented in memory/storage.
Last updated