<p>You have to traverse entire blockchain. At the lowest bitcoin level there is no accounts, there is concept of "unspent output". Bitсoin clients (excluding light versions) should support index of all transactions with unspent output, in order to validate transactions quickly. That means bitcoin clients doesn't actually scan entire blockchain, they just know balance of all accounts.</p>

<p>You are right, it can cause scalability problem, if bitcoin become more valuable, and count of transactions with unspent output will grow very quickly.</p>

CC BY-SA 3.0
2017-08-02T21:53:29.960Z
the index part sounds nice but could also be a bottle neck right? there is about 1 billion credit cards in use right now, assuming there is 1 billion bitcoin user and each meta data cost 1kb that is 1 terabyte of index. Is there propose solution to solve these scalability problem?
Jal
CC BY-SA 3.0
2017-08-02T22:00:25.493Z
Bitcoin wasn't designed to replace existing credit cards. It was designed as decentralized, and any user with PC should be able to run full bitcoin node. But even now it requires very good PC with quick hard drive and good internet connection. So, at the current time and current technology level bitcoin network cannot handle 1 billion active users. I don't like when people compare bitcoin to Visa/Mastercard and other very high load payment systems.
Zergatul
CC BY-SA 3.0
2017-08-02T22:04:32.583Z
ah I see, sorry for the comparison, its just that I see alot of argument on how bitcoin can replace fiat and facilitate machine to machine transaction, so I wanted to understand the fundamental infrastructure a bit more.
Jal
CC BY-SA 3.0
2017-08-03T05:42:37.793Z
Bitcoin Core does not have an index of transactions anymore since 0.8. Instead, there is a database with just the unspent outputs (not an index into the chain, just a copy of all outputs). During validation, the blocks and transactions aren't accessed anymore - only the database is consulted and updated.
Pieter Wuille
CC BY-SA 3.0
2017-08-03T08:10:30.563Z
@PieterWuille That's is what I meant, maybe it wasn't clear. In terms of relative databases, we would say, there is 2 tables, one is blockchain, second is unspent outputs. Index on top of second allows to validate transations in O(log m), where m is number of unspent outputs
Zergatul
CC BY-SA 3.0
2017-08-02T21:46:25.897Z
2017-08-02T21:46:25.897Z
Zergatul
<p>If I want the latest information (ie. account balance) of account A do I have to traverse the entire block chain to get that info or is the relevant information store in the latest block or some other companion data structure?</p>

<p>If I have to traverse the entire block chain, is there going to be scalable problem as block chain grows?</p>

CC BY-SA 3.0
2017-08-03T09:18:29.473Z
Possible duplicate of [How is a wallet's balance computed?](https://bitcoin.stackexchange.com/questions/22997/how-is-a-wallets-balance-computed)
alcio
CC BY-SA 3.0
2017-08-05T20:59:10.740Z
I'm voting to leave open. While the proposed duplicate is closely related it doesn't comprehensively address scalability or complexity of calculating the balances.
Murch
<synchronization><scalability><utxo-set>
Is the asymptotic performance of bitcoin O(n) relative to the block chain length?
Jal
# Is the asymptotic performance of bitcoin O(n) relative to the block chain length?

(Asked by: username_0 on 2017-08-02)

If I want the latest information (ie. account balance) of account A do I have to traverse the entire block chain to get that info or is the relevant information store in the latest block or some other companion data structure?

If I have to traverse the entire block chain, is there going to be scalable problem as block chain grows?

**Tags:** synchronization, scalability, utxo-set

> **Comments:**
> **username_1**: Possible duplicate of [How is a wallet's balance computed?](https://bitcoin.stackexchange.com/questions/22997/how-is-a-wallets-balance-computed)  
> **username_2**: I'm voting to leave open. While the proposed duplicate is closely related it doesn't comprehensively address scalability or complexity of calculating the balances.  

---

## 1 answers

### Answer by username_3 on 2017-08-02. Score: 0 | Accepted answer

You have to traverse entire blockchain. At the lowest bitcoin level there is no accounts, there is concept of "unspent output". Bitсoin clients (excluding light versions) should support index of all transactions with unspent output, in order to validate transactions quickly. That means bitcoin clients doesn't actually scan entire blockchain, they just know balance of all accounts.

You are right, it can cause scalability problem, if bitcoin become more valuable, and count of transactions with unspent output will grow very quickly.

> **Comments:**
> **username_0**: the index part sounds nice but could also be a bottle neck right? there is about 1 billion credit cards in use right now, assuming there is 1 billion bitcoin user and each meta data cost 1kb that is 1 terabyte of index. Is there propose solution to solve these scalability problem?  
> **username_3**: Bitcoin wasn't designed to replace existing credit cards. It was designed as decentralized, and any user with PC should be able to run full bitcoin node. But even now it requires very good PC with quick hard drive and good internet connection. So, at the current time and current technology level bitcoin network cannot handle 1 billion active users. I don't like when people compare bitcoin to Visa/Mastercard and other very high load payment systems.  
> **username_0**: ah I see, sorry for the comparison, its just that I see alot of argument on how bitcoin can replace fiat and facilitate machine to machine transaction, so I wanted to understand the fundamental infrastructure a bit more.  
> **username_4**: Bitcoin Core does not have an index of transactions anymore since 0.8. Instead, there is a database with just the unspent outputs (not an index into the chain, just a copy of all outputs). During validation, the blocks and transactions aren't accessed anymore - only the database is consulted and updated.  
> **username_3**: @username_4 That's is what I meant, maybe it wasn't clear. In terms of relative databases, we would say, there is 2 tables, one is blockchain, second is unspent outputs. Index on top of second allows to validate transations in O(log m), where m is number of unspent outputs  

---

