Circuit Functions
Most commonly used AxiomREPL functions
witness
witness
This function creates a CircuitValue
that can change between different runs of the circuit (think of it as a JavaScript let
). For example, if you wanted to create a circuit that checks if a user's balance is above some threshold, you would make the user's address a witness so that the circuit could be used to prove that any address's balance is above the threshold.
constant
constant
This function creates a CircuitValue
that must be the same every time you run your circuit (think of it as JavaScript const
). For example, from the example above, you could make the threshold a constant to enforce that every time the circuit is run, the same threshold is used.
log
log
The log(...)
function is used to debug the value of a CircuitValue
or a CircuitValue256
(or some array of them). This is useful for debugging and checking that the values inside the circuit are what you would expect.
addToCallback
addToCallback
This function is used to add a values to the data which is passed to your contract when your query is fulfilled. You can call addToCallback
a maximum of 128 times inside AxiomREPL. See Handling Axiom Callbacks for more info on setting up your contract to receive the the data you pass to addToCallback
.
Last updated