Blockchain API? (fetch ada balance)

I’d like to make a little script to keep track of my ADA.
Poke an API, with my address as an argument, and it would list my balance. Something like that.
The only thing I’ve found was and it seems I can only interact with a local running deadalus wallet, but my web linux box does not have access to my wallet box.
I then tried to parse pages on but they have a browser validator so I didn’t continue forcefully :slight_smile:
Anyone could point me in the right direction as to how to accomplish this?
Thank you,

I think cardano-sl is what I need.

Don’t know whether will do what you want or not (browser validator?) but if so I guess it would be easier than the cardano-sl route! :grin:

Yep. You can use if you don’t want to deploy your own instance of cardano-sl. There’s a JSON API for the Explorer. I don’t know if there’s documentation on it, but here’s the source.

To query balance of an address:

curl -s "$address" |
python3 -c "import sys, json; print(float(json.load(sys.stdin)['Right']['caBalance']['getCoin'])/1000000)"
1 Like

LOL literally this like the 4th different place of instruction … PLease can we have only 1 … this is crazy …

Is this even possible? Every time you make a transaction, it sends the balance to a newly generated address - right?

So you could do it, but you would have to type your address in everytime, because the address changed.

I say this because I was going to make an app (I write apps) that could show me my ADA balance on my phone (I get payments from people so it does change every day), however as soon as I started thinking about it, I hit this issue.

Yup, imo, you have to know the root of HD wallet in order to be able to find all the derivative addresses, at least that’s how Daedalus does it. So if you want to track all your addresses - your app has to deal with seeds =\

1 Like

The receive address does not change unless you request a new one.

That’s right, but if you send ADA, then all the change goes to another address. So tracking a single address only shows you full balance if you have no outgoing transaction.


Thanks Vantuz, I did not know that. Never sent any ADA! :slight_smile:

1 Like

UTxO is designed in such a way so separate addresses would not make much sense, and only a wallet allows owner to know that all the addresses are connected. I think the only way is to design a full-wallet app, which might be tricky as hell. So the best solution would be to wait for an official Daedalus for mobile platforms :slight_smile:

Yup, that kinda annoyed me at the beginning that I can’t chose where change is gonna go, cuz I also like to use explorers, and open wallet only when I need to make a transaction, but each outgoing transaction turned my wallet into a garland of addresses. But eh, whatcha gonna do ¯\_(ツ)_/¯

1 Like

Yea, that is the conclusion I came to… so too hard. lol.