<p>Transactions consist of inputs and outputs. Inputs refer to transactions which have sent bitcoins to your public keys (addresses). All a node needs to do is check if the bitcoins being spent are less than or equal to the sum of bitcoins referenced by input transactions (and signature has to verify ofcourse).</p>

CC BY-SA 3.0
2017-02-08T18:29:49.613Z
2017-02-08T18:29:49.613Z
ManfredMacx
<p>Bitcoin wallet does not have any bitcoins. All bitcoins are in blockchain.
Wallet only have private keys. That gave access to bitcoins in blockchain.
You do not need to scan whole blockchain to find out how many bitcoins you have. You just need to check your public address for example through blockchain.info</p>

CC BY-SA 3.0
2017-02-08T17:26:35.607Z
The Bitcoin network does not verify your transaction by querying the privately-operated website blockchain.info. OP asks how nodes can validate transactions by themselves.
Pieter Wuille
CC BY-SA 3.0
2017-02-08T08:38:58.113Z
2017-02-08T08:38:58.113Z
nanadze
<blockquote>
  <p>How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?</p>
</blockquote>

<p>It doesn't. The network doesn't care about wallets or accounts at all. Those are constructs used by other programs to manage bitcoins.</p>

<p>The network just checks to make sure that the inputs a transaction uses are valid.</p>

<blockquote>
  <p>However isn't it feasible if the size of the blockchain becomes really large? Is there any practical way that the current nodes verify whether the transaction is valid? </p>
</blockquote>

<p>Nodes keep an efficient index of unspent outputs. They can then check the inputs of a new transaction to make sure they're in the index of unspent outputs. You have to scan the whole blockchain to build this index, but once it's built, accessing and maintaining it is cheap and efficient.</p>

<p>You can think of an account as a key and unspent outputs as locks. The nodes just have to check that the key fits the lock. It doesn't matter what other locks the key might or might not open. The person who holds a key wants to know what locks it will open, but to know if access is allowed, we just have to check if the key fits the lock it's being put in.</p>

CC BY-SA 3.0
2017-02-08T18:17:32.760Z
2017-02-08T18:17:32.760Z
David Schwartz
<p>How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?</p>

<p>I understand that it is verifiable by scanning the entire blockchain and see whether the wallet has the enough bitcoin in it so that it is possible to make the transaction. </p>

<p>However isn't it feasible if the size of the blockchain becomes really large? Is there any practical way that the current nodes verify whether the transaction is valid? </p>

<transaction-verification>
How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?
Jaebum
# How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?

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

How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?

I understand that it is verifiable by scanning the entire blockchain and see whether the wallet has the enough bitcoin in it so that it is possible to make the transaction.

However isn't it feasible if the size of the blockchain becomes really large? Is there any practical way that the current nodes verify whether the transaction is valid?

**Tags:** transaction-verification


---

## 3 answers

### Answer by username_4 on 2017-02-08. Score: 3 | Accepted answer

> How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?

It doesn't. The network doesn't care about wallets or accounts at all. Those are constructs used by other programs to manage bitcoins.

The network just checks to make sure that the inputs a transaction uses are valid.

> However isn't it feasible if the size of the blockchain becomes really large? Is there any practical way that the current nodes verify whether the transaction is valid?

Nodes keep an efficient index of unspent outputs. They can then check the inputs of a new transaction to make sure they're in the index of unspent outputs. You have to scan the whole blockchain to build this index, but once it's built, accessing and maintaining it is cheap and efficient.

You can think of an account as a key and unspent outputs as locks. The nodes just have to check that the key fits the lock. It doesn't matter what other locks the key might or might not open. The person who holds a key wants to know what locks it will open, but to know if access is allowed, we just have to check if the key fits the lock it's being put in.


---

### Answer by username_1 on 2017-02-08. Score: 1

Transactions consist of inputs and outputs. Inputs refer to transactions which have sent bitcoins to your public keys (addresses). All a node needs to do is check if the bitcoins being spent are less than or equal to the sum of bitcoins referenced by input transactions (and signature has to verify ofcourse).


---

### Answer by username_2 on 2017-02-08. Score: -3

Bitcoin wallet does not have any bitcoins. All bitcoins are in blockchain.
Wallet only have private keys. That gave access to bitcoins in blockchain.
You do not need to scan whole blockchain to find out how many bitcoins you have. You just need to check your public address for example through blockchain.info

> **Comments:**
> **username_3**: The Bitcoin network does not verify your transaction by querying the privately-operated website blockchain.info. OP asks how nodes can validate transactions by themselves.  

---

