There are two ways to create a transaction, the first one is by passing the Cardano wallet address for the utxos (as the changeAddress), and the second one usually used with a frontend (wallet extension), requires to get a list of all cbor utxos to be used for the transaction.
The following examples are covering both approaches.
Objectives
This example sends 10ADA from one wallet to another.
Requirements
A Cardano wallet with ADA
A wallet to send ADA to
A wallet extension to sign the transaction
An API key
The wallets are on Preprod network and using Eternl (So the signature is done in the browser) See for more details.
Using the Address to fetch Utxos
Payload (Using an address only)
Important: This demo is meant for educational and testing purposes only. In production, please pass the UTXO list for your wallet. We recommend using the wallet connector to easily retrieve UTXOs from connected wallets. In this example, the API will fetch the UTXO list for you and automatically determine the UTXO(s) to be used for the transaction.
You can use this payload when you cannot fetch the utxos, for example, when you don't have a wallet extension.
SENDER_ADDRESS="addr_test1qrvx8wgdndrk98qf62vka3q4fglchk7h940vepdtgcv9fuu0e0aeuac6j2xhz77esaaudku68ha89qesqvd29pmuzw6qk8xkcn"
RECEIVER_ADDRESS="addr_test1qztayr885vqrx6w0j946lvtxl622flxx4asj2z4ludm3y2rewu7hmazv8tm78tvphzlream22pp6zhk0rrsa84nf6qxsrua9nh"
# 10 ADA => 1ADA = 1'000'000LOVELACE
LOVELACE_AMOUNT=10_000_000
# See Authentication page for API key details.
X_API_KEY="testnet_EyrkvCWDZqjkfLSe1pxaF0hXxUcByHEhHuXIBjt9"