Skip to main content

On this section you can learn how to debug your smart contracts and common errors that you may run into.

Logging in

You can log statements from contracts that will show ups in the Sandbox.

Import debug_log Import the debug_log dependency from Aztec oracles:

use dep::aztec::oracle::debug_log::{ debug_log };

Write log

Write debug_log() in the appropriate place in your contract.


Other methods for logging include:

debug_log_format(): for logging Field values along arbitrary strings.

debug_log_format("get_2(slot:{0}) =>\n\t0:{1}\n\t1:{2}", [storage_slot, note0_hash, note1_hash]);

debug_log_field(): for logging Fields.


debug_log_array(): for logging array types.


Start Sandbox in debug mode

Prepend the command to start the sandbox with DEBUG=aztec:* to log everything or DEBUG=aztec:simulator:oracle to only log your debug_log() statements.

# Using the docker-compose.yml setup
cd ~./aztec && DEBUG=aztec:* docker-compose up

Alternatively you can update the DEBUG environment variable in docker-compose.yml and start the sandbox normally.

DEBUG: aztec:*