Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: cerealenthusiast on June 25, 2019, 12:29:48 PM



Title: Is there any API that could find addresses that contain a certain UTXO?
Post by: cerealenthusiast on June 25, 2019, 12:29:48 PM
Hi,

I'm trying to build a sort of blockchain explorer, and I would need an API that could get me all the addresses that contains a UTXO > to a certain amount that I would choose. I tried searching online but couldn't really find anything, to my knowledge even blockchain.info doesn't do that.

Otherwise how could I implement it myself?

Thanks,


Title: Re: Is there any API that could find addresses that contain a certain UTXO?
Post by: bob123 on June 25, 2019, 12:34:46 PM
What are you trying to accomplish?

Example:

Code:
UTXO-1                UTXO-2   UTXO-3
------------------------------------------------------------------------
2 BTC          ->     1 BTC  +  1 BTC


Code:
UTXO-2 UTXO-99               UTXO-4     UTXO-5    UTXO-6
-----------------------------------------------------------------------
1 BTC + 1 BTC          ->     0.5 BTC + 0.5 BTC + 1 BTC


What do you define as 'all addresses that contain UTXO' ?
Please explain it with UTXO-2 as an example.


I am not sure whether you have understood how it works.. because your question doesn't really make sense.


Title: Re: Is there any API that could find addresses that contain a certain UTXO?
Post by: cerealenthusiast on June 25, 2019, 12:37:57 PM
Yeah sorry it's not super clear, basically I would just want to get all addresses that have a balance of X amount. I know the blockchain doesn't record balances that's why I specified every addresses that has a minimum UTXO (maybe I'm wrong though?).


Title: Re: Is there any API that could find addresses that contain a certain UTXO?
Post by: bob123 on June 25, 2019, 12:53:37 PM
Ah.. this makes more sense now.

Well.. basically you would run a full node fully indexed and then check the chainstate folder / build a database containing all address/UTXO pairs.

Then its simple sorting.


This tool (https://github.com/mycroft/chainstate (https://github.com/mycroft/chainstate)) could probably help you.
It wouldn't be much effort if you build your application around this tool.


Title: Re: Is there any API that could find addresses that contain a certain UTXO?
Post by: cerealenthusiast on June 25, 2019, 01:01:01 PM
I would have hoped to not have to run a full node for that, I can't really have 260Gigs taken on my drive, that's why I was looking for an api that would just return any addresses with for example 1 BTC in UTXO.


Title: Re: Is there any API that could find addresses that contain a certain UTXO?
Post by: mocacinno on June 25, 2019, 01:05:49 PM
Not exactly an api... But this post might help: https://bitcointalk.org/index.php?topic=5064946.msg47841891#msg47841891


Title: Re: Is there any API that could find addresses that contain a certain UTXO?
Post by: bob123 on June 25, 2019, 01:33:15 PM
I would have hoped to not have to run a full node for that, I can't really have 260Gigs taken on my drive, that's why I was looking for an api that would just return any addresses with for example 1 BTC in UTXO.

If you want to build your own blockchain explorer, you will need to have your own full node.

There is no way without.

If you can't afford a 500GB HDD, better don't try to build your own blockchain explorer.


Title: Re: Is there any API that could find addresses that contain a certain UTXO?
Post by: AdolfinWolf on June 26, 2019, 04:21:54 PM
I think Goochain lets you filter this, no?

https://goochain.net

You can use the "Equal or min" v "Max" feature, and set a range of dates?

I'm not sure if they have an api though. i don't think so. Hmm. Might not really be what you're looking for.

Not exactly an api... But this post might help: https://bitcointalk.org/index.php?topic=5064946.msg47841891#msg47841891
What i was thinking too. If you don't want to run your own node/download chainstate, i guess you can simply use that to filter out all the adresses that have more/less than X amount of satoshi?
Although.. adresses =/= utxo's.