Secure Operations and Gas
Secure operations are supported via our gcEVM extension, which is implemented through a set of precompiled contracts.
Last updated
Secure operations are supported via our gcEVM extension, which is implemented through a set of precompiled contracts.
Last updated
To bring a new private datum into the gvEVM the function's signature should include an argument of type Inputtext
. Then, inside the function, it is necessary to call ValidateCiphertext
, which returns a Garbledtext
if verification succeeds and an error otherwise. Then, the contract is free to save private data temporarily in Memory, by calling Offboard
on the relevant Garbledtext.
This returns a private datum of type Ciphertext
that awaits other commands, namely, the Ciphertext
type cannot serve as an operand to secure operations, rather it should be Onboarded
again and turn into a Garbledtext
first; alternatively, the Ciphertext
may be stored permanently by simply assigning it to a state variable of the contract.
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 operations supported on Garbledtext
and their required gas prices
Operation | Bool | gtUint8 | gtUint16 | gtUint32 | gtUint64 |
---|---|---|---|---|---|
A more detailed explanation on the functionality of these functions can be found in the following link.
Operation | gtBool | gtUint8 | gtUint16 | gtUint32 | gtUint64 |
---|---|---|---|---|---|
And
12005
12040
12080
12160
12320
Or
12005
12042
12084
12169
12339
Xor
12000
12000
12001
12003
12006
Add
12037
12080
12167
12340
Sub
12080
12165
12337
12679
Mul
12620
14571
22467
54233
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
Ne
12000
12037
12079
12164
12334
Shl
100
100
100
100
Shr
100
100
100
100
Not
12000
SetPublic
12000
12000
12001
12003
12006
Decrypt
12000
12000
12001
12003
12006
Onboard
47039
47039
47039
47039
47039
ValidateCiphertext
47039
47039
47039
47039
47039
Offboard
47039
47040
47040
47042
47045
OffboardToUser
47039
47040
47040
47042
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