Inner Workings of Functions
Below, we go more into depth of what is happening under the hood when you create a function in an Aztec contract. The next page will give you more information about what the attributes are really doing.
Function transformation
When you define a function in an Aztec contract, it undergoes several transformations when it is compiled. These transformations prepare the function for execution. These transformations include:
- Creating a context for the function
- Handling function inputs
- Processing return values
- Generating function signatures
- Generating contract artifacts
Let's explore each of these transformations in detail.
Context creation
Every function in an Aztec contract operates within a specific context which provides some extra information and functionality. This is either a PrivateContext or PublicContext object, depending on whether it is a private or public function. For private functions, it creates a hash of all input parameters to ensure privacy.