<p>Essentially for each transaction that you want to initiate, you (or more specifically your client) indicate where you got the money from that you want to use for that transaction. These are called the inputs to your transaction. Your recipient (and actually every node on the network) then looks to make sure that you haven't spent that money from that transaction anywhere else. (This is the double spend issue that is referenced in another answer).</p>

<p>It's easy to implement efficiently because every synced bitcoin client has a complete list of all transactions. And they can index those transactions based on the transaction id so that they can very quickly lookup whether a transaction has already been spent or not. Or for that matter whether that transaction exists at all or not.</p>

<p>In other words, if you tried to spend 10 BTC that you didn't really have, you would have to "make up" a fake transaction of where you got that 10BTC from. And any client on the network would instantly detect that your made up transaction didn't exist and refuse to propagate your new transaction.</p>

<p>@Zim Brott
Actually this is a little different than a double spend problem the way I read it.</p>

CC BY-SA 3.0
2013-04-03T19:41:44.280Z
2013-04-03T19:41:44.280Z
David Ogren
<p>This is called the "double-spending" problem. There's an excelent article on the Bitcoin Wiki that covers the entire mechanism. </p>

<p><a href="https://en.bitcoin.it/wiki/Double-spending" rel="nofollow">https://en.bitcoin.it/wiki/Double-spending</a></p>

CC BY-SA 3.0
2013-04-03T15:49:54.287Z
2013-04-03T15:49:54.287Z
Zim Brott
<p>I am new to bitcoin, I was wondering how bitcoin implements this particular functionality efficiently. Does it check through all blockchain records for the address of the sender. Or does each transaction store a list of previous transactions by the sender?</p>

<p>I am curious as to how this can be implemented efficiently?</p>

<transactions><blockchain>
How does bitcoin prevent someone from sending more money than he/she has?
Vivek
# How does bitcoin prevent someone from sending more money than he/she has?

(Asked by: username_0 on 2013-04-03)

I am new to bitcoin, I was wondering how bitcoin implements this particular functionality efficiently. Does it check through all blockchain records for the address of the sender. Or does each transaction store a list of previous transactions by the sender?

I am curious as to how this can be implemented efficiently?

**Tags:** transactions, blockchain


---

## 2 answers

### Answer by username_1 on 2013-04-03. Score: 2 | Accepted answer

Essentially for each transaction that you want to initiate, you (or more specifically your client) indicate where you got the money from that you want to use for that transaction. These are called the inputs to your transaction. Your recipient (and actually every node on the network) then looks to make sure that you haven't spent that money from that transaction anywhere else. (This is the double spend issue that is referenced in another answer).

It's easy to implement efficiently because every synced bitcoin client has a complete list of all transactions. And they can index those transactions based on the transaction id so that they can very quickly lookup whether a transaction has already been spent or not. Or for that matter whether that transaction exists at all or not.

In other words, if you tried to spend 10 BTC that you didn't really have, you would have to "make up" a fake transaction of where you got that 10BTC from. And any client on the network would instantly detect that your made up transaction didn't exist and refuse to propagate your new transaction.

@username_2
Actually this is a little different than a double spend problem the way I read it.


---

### Answer by username_2 on 2013-04-03. Score: 2

This is called the "double-spending" problem. There's an excelent article on the Bitcoin Wiki that covers the entire mechanism.

<https://en.bitcoin.it/wiki/Double-spending>


---

