Private and public functions can require an authorization check to be performed before execution. This
is typically the case when the function allows performing an action on behalf of someone who is not
the caller.
This macro injects the necessary code to perform the check via the authwit mechanism and additionally
emit the authorization request as an offchain effect, so a user/wallet can verify what are they
being asked to sign.
This check also emits a nullifier with the provided nonce argument, so authorizations are valid
once and only once, preventing replay attacks.
An initializer function is similar to a constructor:
- it can only be called once
- if there are multiple initializer functions, only one of them can be called
- no non-initializer functions can be called until an initializer has ben called (except
noinitcheck functions)
Internal functions can only be called by the contract itself, typically from private into public.
Functions with noinitcheck can be called before contract initialization.
Private functions are executed client-side and preserve privacy.
Public functions are executed sequencer-side and do not preserve privacy, similar to the EVM.
Utility functions are standalone unconstrained functions that cannot be called from another function in a contract.
They are typically used either to obtain some information from the contract (e.g. token balance of a user) or to
modify internal contract-related state of PXE (e.g. processing logs in Aztec.nr during sync).
View functions can only be called in a static execution context.