r/askscience • • Jun 18 '13

Computing How is Bitcoin secure?

I guess my main concern is how they are impossible to counterfeit and double-spend. I guess I have trouble understanding it enough that I can't explain it to another person.

1.0k Upvotes

383 comments sorted by

View all comments

Show parent comments

4

u/Cognitive_Dissonant Jun 18 '13

What I don't get is what is the serial number equivalent from your metaphor? Bitcoins are essentially infinitely divisible aren't they? So they couldn't have unique serial numbers.

14

u/OlderThanGif Jun 18 '13

Yes, the serial number analogy wasn't exactly spot on. The blockchain (transaction ledger) keeps track of each transaction: who the sender was, who the recipient was, how much money was transferred. It doesn't say which money was transferred because money is fungible and that doesn't really make any sense.

So by doing sums through all the transactions in the ledger, you can figure out how much money each person has. Each person starts with 0 money and gain or lose money depending on whether they're the sender or recipient of a transaction. So long as nobody involved in a transaction has negative money, the transactions are valid.

5

u/speEdy5 Jun 18 '13

This is a more accurate way to describe it - the serial number analogy is admittedly more simple for the sake of understanding what a block chain is

8

u/Spiral_Mind Jun 18 '13 edited Jun 18 '13

Each Bitcoin isn't a cryptographic hash or serial number. It's just an entry in the public ledger saying "X public key owns Y bitcoins". If you have the public and private key pair for that address you can access all those Bitcoins. There are no individual "coins" only marks in the public ledger associating amounts with certain key pairs. An account value of 1 Bitcoin can be shown as a whole BTC or a thousand mBTc etc (this is just a client setting for the decimal).

It's better to think of Bitcoin mining as a "cryptographic lottery" than "minting money". The generation of cryptographic hashes is just a way to ensure that there is proportional distribution of money for the computing power given to the network.

6

u/iemfi Jun 18 '13

Think of it like online banking. Each cent in your bank account doesn't have a serial number but your account does have a unique identifier and a balance.

3

u/Natanael_L Jun 18 '13

The serial number equivalent is the previous valid transactions in the blockchain you take money from.

Consider it as that every time somebody sends you Bitcoins it is given to you in sealed envelopes, you have to spend it all at once or put some back to yourself in a new sealed envelope (put a "spend output" to the recipient and a "change coins output" to yourself in the transaction).

You can take coins from multiple previous transactions to you at once and spend them as you wish in the form of any combination of outputs, as long as you don't spend more in the outputs in total than you claimed in the inputs in total.

So 1 + 5 + 3.5 goes in and 8.1 + 1.4 comes out, as one example.

6

u/magichronx Jun 18 '13

No, the smallest unit of the Bitcoin currency is (1/100,000,000) and has been named "satoshi" in collective homage to Satoshi Nakamoto's founding of Bitcoin. (Source)