Overview
One of the key aspects of writing confidential smart contracts is receiving encrypted inputs from users:Notice in the example above the distinction between
InEuint32 and euint32.Input Types Conversion
The input typesInEuintxx (and InEbool, InEaddress) are special encrypted types that represent user input. Input types contain additional information required to authenticate and validate ciphertexts. For more on that, read about the ZK-Verifier.
Before you can use an encrypted input, you need to convert it to a regular encrypted type:
amount is of type euint32, you can store or manipulate it:
Full Example
Here’s a complete example showing how to handle encrypted inputs in a transfer function:For the example above to work correctly, you will also need to manage access to the newly created ciphertexts in the
_updateBalance() function. Learn more about access control in the ACL Mechanism guide.