# Private Data Types

The gcEVM extends the capabilities of the EVM across various dimensions. Initially, it introduces novel data types to accommodate the necessity of maintaining privacy. Subsequently, it introduces additional operations capable of manipulating these private data types without compromising their secrecy.

## Data Types

To support privacy, we introduce a new set of data types mirroring the existing solidity types.\
We present four new types needed for manipulating private smart contracts:

* Ciphertext (ctBool, ctUint8, ctUint16, ctUint32, ctUint64, ctUint128, ctUint256, ctString)
* Usertext (utBool, utUint8, utUint16, utUint32, utUint64, utUint128, utUint256, utString)
* Inputtext (itBool, itUint8, itUint16, itUint32, itUint64, itUint128, itUint256, itString)
* Garbledtext™ (gtBool, gtUint8, gtUint16, gtUint32, gtUint64, gtUint128, gtUint256, gtString)

We make a distinction between private data types that are used for encrypting the values of transaction inputs, variables stored in storage slots and variables stored in memory. That is, while the Ciphertext and Usertext data types (denoted CT and UT respectively) are used to secure data in storage, we use the Inputtext data type (denoted IT) for protecting data in transaction inputs and the Garbledtext™ data type (denoted GT) for protecting data in use.

{% hint style="info" %}
Detailed examples of these types and converting between them are found in the [**coti-contracts-examples**](https://github.com/coti-io/coti-contracts-examples) repository.
{% endhint %}

**Usage**

* **Ciphertext** is one of two types utilized for storing encrypted data in contract storage. Note that a Ciphertext can be encrypted either with an EOA's AES key or the network key.
* **Usertext** is another type utilized for storing encrypted data in contract storage. It is comprised of two parts:
  * ciphertext: a value of type Ciphertext that is encrypted with the network key
  * userCiphertext: a value of type Ciphertext that is encrypted with an EOA's AES key
* **Inputtext** is used when an EOA performs a transaction with encrypted inputs. It is comprised of two parts:
  * ciphertext: a value of type Ciphertext that is encrypted with an EOA's AES key
  * signature: a signature generated according to the protocol standard using the EOA's private key
* **Garbledtext™** is a data type used for computations on encrypted data or for securely passing encrypted data between contracts. These values are temporary and exist only during the execution of a transaction, being automatically deleted once the transaction completes. Both Inputtext and Ciphertext values can be converted into Garbledtext, and conversely, Garbledtext values can be converted back into Ciphertext for permanent on-chain storage.

## Life-cycle of private data within the gcEVM

<figure><img src="/files/xclAccoLJqMyinjLxN7h" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
It's essential to acknowledge that without a security mechanism in place, there's a risk of potential malicious exploitation of these types. To mitigate such risks, the gcEVM incorporates a security mechanism aimed at preventing any dishonest activities, such as unauthorized copying of secret data. For more information about the security mechanism please refer to the [whitepaper](/coti-documentation/how-coti-works/advanced-topics/white-paper-0.1.md).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coti.io/coti-documentation/build-on-coti/core-concepts/secure-data-types.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
