aztec-nr - noir_aztec::macros::functions

Function external

pub comptime fn external(f: FunctionDefinition, f_type: CtString)

An external function is callable from outside the contract.

There are three types of external functions:

  • private: executed client-side and preserve privacy
  • public: executed by the sequencer and do not preserve privacy (like on the EVM)
  • utility: helpers that are never executed on-chain, typically used for state queries

external functions are the Aztec equivalent of a Solidity external function, though their behavior differs slightly for public, private and utiliy functions.

external functions can also be made initializer (for contract intialization), view (for read-only behavior), authorize_once (for basic access control) and only_self (to prevent other contracts from calling them).