How to get Cardano unspent transaction outputs (UTxO) via API?

Viewed 488

Currently, I can get only Cardano (ADA) "balance" via blockchain API but it does not include UTXOs. I want to find the way how to get UTXO of Cardano address.

I use Python to get API.

3 Answers

You can setup cardano rosetta server and fetch account coins and balance details from here:

https://www.rosetta-api.org/docs/AccountApi.html

and then you can create the utxo formats from here:

https://github.com/input-output-hk/cardano-rosetta/blob/master/examples/commons.ts

In Python module for Cardano, the Wallet object has a utxo_stats() method which returns a histogram of UTxO statistics. The result consists of three elements: total balance, histogram and scale.

wallet.utxo_stats()

Found the BlockFrost API was able to do this with minimal effort.

I was using the .Net API but they have API for python. Seems to be the best service I have found so far.

https://docs.blockfrost.io/

Related