> For the complete documentation index, see [llms.txt](https://docs.coti.io/coti-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coti.io/coti-documentation/build-on-coti/core-concepts/secure-operations-and-gas.md).

# 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

{% hint style="warning" %}
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.
{% endhint %}

List of arithmetic operations supported using `Garbledtext` and their required Gas units

<table data-full-width="false"><thead><tr><th width="250.84375">Operation</th><th>Bool</th><th>gtUint8</th><th>gtUint16</th><th>gtUint32</th><th>gtUint64</th><th>gtUint128</th><th>gtUint256</th><th>gtString**</th><th data-hidden data-type="number">gtString</th></tr></thead><tbody><tr><td><code>And</code></td><td>12005</td><td>12040</td><td>12080</td><td>12160</td><td>12320</td><td>26126</td><td>52742</td><td></td><td>null</td></tr><tr><td><code>Or</code></td><td>12005</td><td>12042</td><td>12084</td><td>12169</td><td>12339</td><td>26164</td><td>52818</td><td></td><td>null</td></tr><tr><td><code>Xor</code></td><td>12000</td><td>12000</td><td>12001</td><td>12003</td><td>12006</td><td>25498</td><td>51486</td><td></td><td>null</td></tr><tr><td><code>Shl</code></td><td></td><td>12620</td><td>14571</td><td>22467</td><td>54233</td><td>226190</td><td>698489</td><td></td><td>null</td></tr><tr><td><code>Shr</code></td><td></td><td>12969</td><td>15960</td><td>28009</td><td>76377</td><td>248333</td><td>698498</td><td></td><td>null</td></tr><tr><td><code>Add</code></td><td></td><td>12037</td><td>12080</td><td>12167</td><td>12340</td><td>65491</td><td>275564</td><td></td><td>null</td></tr><tr><td><code>CheckedAdd</code></td><td></td><td>26252</td><td>26318</td><td>26407</td><td>26577</td><td>115473</td><td>375554</td><td></td><td>null</td></tr><tr><td><code>CheckedAddWithOverflowBit</code></td><td></td><td>12738</td><td>12781</td><td>12857</td><td>13041</td><td>103457</td><td>389274</td><td></td><td>null</td></tr><tr><td><code>Sub</code></td><td></td><td>12080</td><td>12165</td><td>12337</td><td>12679</td><td>66518</td><td>278659</td><td></td><td>null</td></tr><tr><td><code>CheckedSub</code></td><td></td><td>26341</td><td>26403</td><td>26576</td><td>26917</td><td>142480</td><td>522302</td><td></td><td>null</td></tr><tr><td><code>CheckedSubWithOverflowBit</code></td><td></td><td>12781</td><td>12866</td><td>13038</td><td>13380</td><td>104484</td><td>392369</td><td></td><td>null</td></tr><tr><td><code>Mul</code></td><td></td><td>12620</td><td>14571</td><td>22467</td><td>54233</td><td>2702996</td><td>37473014</td><td></td><td>null</td></tr><tr><td><code>CheckedMul</code></td><td></td><td>26859</td><td>28754</td><td>36684</td><td>68536</td><td>3722546</td><td>50361135</td><td></td><td>null</td></tr><tr><td><code>CheckedMulWithOverflowBit</code></td><td></td><td>13321</td><td>15272</td><td>23168</td><td>54934</td><td>3673338</td><td>50272807</td><td></td><td>null</td></tr><tr><td><code>Div</code></td><td></td><td>12969</td><td>15960</td><td>28009</td><td>76377</td><td></td><td></td><td></td><td>null</td></tr><tr><td><code>Rem</code></td><td></td><td>12969</td><td>15960</td><td>28009</td><td>76377</td><td></td><td></td><td></td><td>null</td></tr><tr><td><code>Min</code></td><td>12010</td><td>12121</td><td>12249</td><td>12503</td><td>13012</td><td>118320</td><td>302289</td><td></td><td>null</td></tr><tr><td><code>Max</code></td><td>12010</td><td>12121</td><td>12249</td><td>12503</td><td>13012</td><td>118986</td><td>303621</td><td></td><td>null</td></tr><tr><td><code>Lt</code></td><td>12005</td><td>12080</td><td>12166</td><td>12337</td><td>12679</td><td>52366</td><td>156113</td><td></td><td>null</td></tr><tr><td><code>Gt</code></td><td>12010</td><td>12121</td><td>12249</td><td>12503</td><td>13012</td><td>53032</td><td>157445</td><td></td><td>null</td></tr><tr><td><code>Ge</code></td><td>12005</td><td>12080</td><td>12165</td><td>12337</td><td>12679</td><td>52699</td><td>157101</td><td></td><td>null</td></tr><tr><td><code>Le</code></td><td>12010</td><td>12122</td><td>12249</td><td>12503</td><td>13012</td><td>52688</td><td>156446</td><td></td><td>null</td></tr><tr><td><code>Eq</code></td><td>12000</td><td>12037</td><td>12079</td><td>12164</td><td>12334</td><td>38650</td><td>89992</td><td>12334</td><td>null</td></tr><tr><td><code>Ne</code></td><td>12000</td><td>12037</td><td>12079</td><td>12164</td><td>12334</td><td>38650</td><td>89992</td><td>12334</td><td>null</td></tr><tr><td><code>Not</code></td><td>12000</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>null</td></tr></tbody></table>

\*\* 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

{% hint style="info" %}
A more detailed explanation on the functionality of these functions can be found in the [**MPC Core library**](/coti-documentation/build-on-coti/tools/contracts-library/mpc-core.md).
{% endhint %}

<table><thead><tr><th width="258">Operation</th><th>gtBool</th><th>gtUint8</th><th>gtUint16</th><th>gtUint32</th><th>gtUint64</th><th>gtUint128</th><th>gtUint256</th><th>gtString**</th></tr></thead><tbody><tr><td><code>SetPublic</code></td><td>12000</td><td>12000</td><td>12001</td><td>12003</td><td>12006</td><td>25064</td><td>50591</td><td>12006</td></tr><tr><td><code>Decrypt</code></td><td>12000</td><td>12000</td><td>12001</td><td>12003</td><td>12006</td><td>24969</td><td>50038</td><td>12006</td></tr><tr><td><code>Onboard</code></td><td>47039</td><td>47039</td><td>47039</td><td>47039</td><td>47039</td><td>99442</td><td>199389</td><td>47039</td></tr><tr><td><code>ValidateCiphertext</code></td><td>47039</td><td>47039</td><td>47039</td><td>47039</td><td>47039</td><td>97624</td><td>196779</td><td>47039</td></tr><tr><td><code>Offboard</code></td><td>47039</td><td>47040</td><td>47040</td><td>47042</td><td>47045</td><td>95207</td><td>190885</td><td>47045</td></tr><tr><td><code>OffboardToUser</code></td><td>47039</td><td>47040</td><td>47040</td><td>47042</td><td>47045</td><td>95818</td><td>192112</td><td>47045</td></tr><tr><td><code>OffBoardCombined</code></td><td>94078</td><td>94080</td><td>94080</td><td>94084</td><td>94090</td><td>191485</td><td>384025</td><td>94090</td></tr><tr><td><code>Rand</code></td><td>6000</td><td>6000</td><td>6000</td><td>6000</td><td>6000</td><td>12940</td><td>26319</td><td></td></tr><tr><td><code>RandBoundedBits</code></td><td>6000</td><td>6000</td><td>6000</td><td>6000</td><td>6000</td><td>13191</td><td>26858</td><td></td></tr><tr><td><code>Mux</code></td><td>12005</td><td>12041</td><td>12083</td><td>12166</td><td>12332</td><td>26200</td><td>50038</td><td></td></tr><tr><td><code>Transfer</code></td><td></td><td>12201</td><td>12413</td><td>12837</td><td>13685</td><td>237367</td><td>817758</td><td></td></tr><tr><td><code>TransferWithAllowance</code></td><td></td><td>12301</td><td>12619</td><td>13255</td><td>14527</td><td>395565</td><td>1318764</td><td></td></tr></tbody></table>

\*\* 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coti.io/coti-documentation/build-on-coti/core-concepts/secure-operations-and-gas.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
