Author

Topic: How does blockchain get your address balance? (Read 882 times)

legendary
Activity: 3472
Merit: 4801
September 26, 2014, 04:54:31 AM
#4
How does blockchain.info calculates your address balance (unspent)?

You'd have to get access to their source code to know for certain, but they almost certainly run multiple instances of custom designed nodes that index the transactions as they are seen on the network and add them to a custom relational database.

Do they really have a database with all the transactions?

That depends on what you mean by "all" the transactions.  They certainly have all the transactions that are confirmed in the blockchain.  They also have MANY of the transactions that have been broadcast on the network, but which aren't yet confirmed into any blocks.

If yes;
How do they get all the transactions?

You'd have to get access to their source code to know for certain, but they almost certainly run multiple instances of custom designed nodes that index the transactions as they are seen on the network and add them to a custom relational database.

Do really have a cronjob wich import all the transactions into there db when there is a new block found?

Cronjob?  I doubt it.  That would be very inefficient, and too slow.  Far more likely they have multiple daemons that run continuously and add the transactions to their DB as soon as they see it broadcast on the network.

I am trying to check the balance of my addresses in my bitcoin daemon. The easyiest way is to use listunspent and put them in a database.

If you don't use the wallet much, that should work.

But that will only be fast when the list aint that big.

Correct.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
September 26, 2014, 03:04:04 AM
#3
How does blockchain.info calculates your address balance (unspent)?

Do they really have a database with all the transactions?

If yes;
How do they get all the transactions? Do really have a cronjob wich import all the transactions into there db when there is a new block found?

I am trying to check the balance of my addresses in my bitcoin daemon. The easyiest way is to use listunspent and put them in a database. But that will only be fast when the list aint that big.

AFAIK they have a big database that gets updated with every block and confused with every 1000th orso block. Most likely they use blocknotify or a custom client that updates the database. A cronjob makes no sense as you do not know when a new block will be available.
newbie
Activity: 28
Merit: 0
September 26, 2014, 02:02:16 AM
#2
BlockChain implements their own storage methods for the blockchain if I am correct. They have things "pre-indexed" as a laymans term. As you said listunspent is actually a very good method of doing it.
legendary
Activity: 1025
Merit: 1001
September 25, 2014, 03:08:36 PM
#1
How does blockchain.info calculates your address balance (unspent)?

Do they really have a database with all the transactions?

If yes;
How do they get all the transactions? Do really have a cronjob wich import all the transactions into there db when there is a new block found?

I am trying to check the balance of my addresses in my bitcoin daemon. The easyiest way is to use listunspent and put them in a database. But that will only be fast when the list aint that big.
Jump to: