Skip to main content
This guide covers executing transactions on the Aleo network using snarkVM, including authorization, execution, and fee handling.

Transaction Types

snarkVM supports several transaction types:
  • Execute: Call a program function with inputs
  • Deploy: Deploy a new program to the network
  • Fee: Pay transaction fees (public or private)

Basic Execution

Execute a program function using VM::execute:

Execution with Response

Get both the transaction and the execution response:

Two-Step Authorization and Execution

For more control, separate authorization from execution:

Fee Handling

Public Fees

Pay fees from your public balance:

Private Fees

Pay fees using a credits record:
Private fees require at least one unspent credits record. Use find_unspent_credits_records to locate available records.

Working with Records as Inputs

Many functions require record inputs:

Transaction Verification

Verify a transaction before broadcasting:

Execution Cost Calculation

Calculate the cost before executing:

Error Handling

Handle common execution errors:

Advanced: External Calls

Programs can call other programs:

Performance Optimization

Parallel Execution

Process multiple transactions in parallel when they don’t conflict:

Reuse Authorizations

Authorize once, execute multiple times with different fee strategies:

Next Steps