Automatic UTXO Selection
Automatic UTXO Selection in Testing Environments
Overview
When building a Cardano transaction with Anvil API, you have two options for specifying transaction inputs:
Provide UTXO List - Explicitly specify which UTXOs to use (required in production)
Automatic Selection - Let Anvil choose UTXOs for you (testing environments only)
Automatic UTXO Selection in Testing
In test environments (preprod, preview), the utxos
parameter in the transaction building API is optional. If you don't provide it, Anvil will:
Automatically fetch UTXOs associated with the
changeAddress
Select appropriate UTXOs to cover the transaction
Handle all input management for you
This simplifies development and testing by removing the need to manage UTXO selection logic until you're ready for production.
Production Requirement
For production environments, you must explicitly provide UTXOs using the utxos
parameter:
Why Is This Useful?
Automatic UTXO selection simplifies development and testing by:
Reducing implementation complexity during early development
Allowing you to focus on application logic rather than UTXO management
Making it faster to prototype and test functionality
Related Resources
Last updated
Was this helpful?