Handles
Unique Identifier for an immutable piece of hidden data
E-Types
At the top of the confidential token implementation, we can see that we are importing new types of variables:
euint256
and ebool
are the hidden counterparts of uint256
and bool
, respectively.
They are used to represent hidden values in the contract.
The e
- types are the hidden counterparts of the standard types in Solidity.
In our token example, the user balances are notably represented as euint256
:
If we look into Inco’s library, we can see how euint256
and ebool
are defined:
If we try looking up on a block explorer the raw value returned by calling balanceOf
, we will get something like:
This gibberish value gives us no information about the actual balance of the user.
What is a Handle?
A handle is a unique identifier for an immutable piece of hidden data.
In our token example, the balance of each user is represented as a handle, ebool success
, euint256 value
, etc. are also handles.
The onchain smart contract is manipulating identifiers for a piece of hidden data (a balance, a boolean, etc.),
and the actual data is safely stored offchain in an encrypted manner.
Whenever an operation is performed over encrypted data types, the result is also a handle, like so:
A handle is immutable. If we were to reassigning a variable like so:
balanceOf[msg.sender]
would get assigned a new handle.
It is important to keep in mind that the handle representing the old balance still exists,
and still corresponds to the encrypted value of the old balance, even if the contract is not keeping track of it.
We will see later in this guide that the value of handles are never lost and can still be accessed.
From Inco’s standpoint, handles get created but never deleted.
Was this page helpful?