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
26126
52742
Or
12005
12042
12084
12169
12339
26164
52818
Xor
12000
12000
12001
12003
12006
25498
51486
Shl
12620
14571
22467
54233
226190
698489
Shr
12969
15960
28009
76377
248333
698498
Add
12037
12080
12167
12340
65491
275564
CheckedAdd
26252
26318
26407
26577
115473
375554
CheckedAddWithOverflowBit
12738
12781
12857
13041
103457
389274
Sub
12080
12165
12337
12679
66518
278659
CheckedSub
26341
26403
26576
26917
142480
522302
CheckedSubWithOverflowBit
12781
12866
13038
13380
104484
392369
Mul
12620
14571
22467
54233
2702996
37473014
CheckedMul
26859
28754
36684
68536
3722546
50361135
CheckedMulWithOverflowBit
13321
15272
23168
54934
3673338
50272807
Div
12969
15960
28009
76377
Rem
12969
15960
28009
76377
Min
12010
12121
12249
12503
13012
118320
302289
Max
12010
12121
12249
12503
13012
118986
303621
Lt
12005
12080
12166
12337
12679
52366
156113
Gt
12010
12121
12249
12503
13012
53032
157445
Ge
12005
12080
12165
12337
12679
52699
157101
Le
12010
12122
12249
12503
13012
52688
156446
Eq
12000
12037
12079
12164
12334
38650
89992
12334
Ne
12000
12037
12079
12164
12334
38650
89992
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
SetPublic
12000
12000
12001
12003
12006
25064
50591
12006
Decrypt
12000
12000
12001
12003
12006
24969
50038
12006
Onboard
47039
47039
47039
47039
47039
99442
199389
47039
ValidateCiphertext
47039
47039
47039
47039
47039
97624
196779
47039
Offboard
47039
47040
47040
47042
47045
95207
190885
47045
OffboardToUser
47039
47040
47040
47042
47045
95818
192112
47045
OffBoardCombined
94078
94080
94080
94084
94090
191485
384025
94090
Rand
6000
6000
6000
6000
6000
12940
26319
RandBoundedBits
6000
6000
6000
6000
6000
13191
26858
Mux
12005
12041
12083
12166
12332
26200
50038
Transfer
12201
12413
12837
13685
237367
817758
TransferWithAllowance
12301
12619
13255
14527
395565
1318764
** 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
Was this helpful?