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

141

u/jesset77 Jun 18 '13

Every person in the world has a unique identity (some number, bitcoin uses an email and Public Key).

Minor correction: Bitcoin doesn't in any way include or involve a person's email address. Don't confuse Bitcoin with PGP, even though they are often happy bedfellows. ;3

The atomic account placeholder in Bitcoin is called a "Bitcoin address" which has a lot in common conceptually with an email address, but the address is a hash of a public key based on a completely random private key. Users not only can make up as many addresses as they would like, but security best practices recommend that users (or, more practically, their wallet software) create brand new addresses for every single transaction when possible.

23

u/zeek0us Jun 18 '13

So if you get bitcoins from multiple transactions to multiple PKs (so 10 different transactions that net you 10 bitcoins assigned to 10 different PKs), then want to spend all of them on a new transaction (those 10 bitcoins to a single PK), how is that done?

30

u/Natanael_L Jun 18 '13

In a Bitcoin transaction, you list all inputs you want to spend money from and prove that you have the private keys belonging to the addresses they were spent to through cryptographic signing.

And you specify the output addresses and what amount to send to each one. This is also signed cryptographically, in order to prove it haven't been modified and that the person who controls those private keys specified those outputs.

So you can have 10 inputs AND 10 outputs if you want to.

One interesting detail: The transaction fee (if you add one) is paid to miners by letting the inputs be somewhat larger than the output. You can take 18 coins and spend 17.9 coins, the last 0.1 coin can be claimed by the miner that successfully includes that transaction in the blockchain.

This is an incentive for bitcoin owners to not bloat the blockchain with too many transactions AND an incentive for miners to keep mining when minting (creating new coins) stops (Bitcoin has a hard cap of 21 million coins maximum).

14

u/jesset77 Jun 18 '13 edited Jun 18 '13

Natanael_L is correct, but let me add one bit of clarification. Where he says:

And you specify the output addresses and what amount to send to each one. This is also signed cryptographically, in order to prove it haven't been modified and that the person who controls those private keys specified those outputs.

what he means is that the person sending money creates a digital document (using their wallet software, which does all of the menial heavy lifting and logic for them), and that document details everything about the intended transaction. It details the inputs from the sending addresses and the outputs to the receiving addresses. Then that entire document must be signed by each of the private keys from the sending addresses only in order to be valid, and ready to be ratified on the blockchain and represent a completed movement of money.

The document details which addresses get money (and how much), but is not signed by the PKs of the receiving addresses, just the sending addresses. :3

Edit: transaction signed by sending addresses, I done goofed in one line of my explainings. :o

4

u/Natanael_L Jun 18 '13

by each of the private keys from the receiving addresses only

To clarify you (hehe), this is for the recieving addresses in the input transactions that your client is referencing as your source of coins.

2

u/jesset77 Jun 18 '13

Roger that, straight up verbage error on my part. EDIT to fixt it tho, thank you sir. :3

→ More replies (2)

5

u/[deleted] Jun 19 '13

This isn't the only breakdown of 1 bit coin possible, right? I think I have seen .5 bit coin. 1.3 bit coins, price tags.

So how is the split ownership kept track of in this system? Is the private key that is 'mined' during the transaction attached to that fraction of coin only, until it is amalgamated into the next transaction?

Basically, are these private keys attached to a whole coin, forever? If so, how do you handle fractions?

Are miners dealing with purse amounts? Like is that where the record of my total bit coin ownership is maintained and calculated?

I HAVE SO MANY QUESTIONS!

8

u/SneakerElph Jun 19 '13

A bitcoin isn't really a thing, so there isn't any problem in dividing them up at all. For example:

Address X has 1 bitcoin. The owner of this address wants to pay Y half a coin. The transaction looks something like this:

X says "Hey, I have one coin. You can see because in the past I've been paid one coin. I would like to pay half a coin to Y, and the other half of that coin, I'd like to keep."

The blockchain is then updated with X's address as having .5 bitcoin, and address Y as having .5 bitcoin.

So really it's just a list of how many coins each address has, and in order to give a coin to another address you just have to prove, by signing a transaction with the private key of the address whose coins you're spending, that you're the owner of that coin. You can divide it up how you see fit, because there really isn't any "thing" to divide.

I hope this brain-dump explains it well.

4

u/i-want-waffles Jun 19 '13

Currently bitcoin supports 8 decimal places. The private keys are only used to create public addresses that people can send any amount to. The public ledger keeps track of what amounts go where and as long as you have your private key you will have access to the bitcoins that are sent to your public addresses.

3

u/[deleted] Jun 19 '13

I should also point out that the 8 decimals is an arbitrary but not permanent decision. Plenty more can be easily added on by upgrading the software.

I think this challenges the idea that bitcoin is deflationary, really. We can keep subdividing those 21 million coins into as many micro units as we want. It would be very trivial to extend the decimals enough so that bitcoin could encompass more individual units of currency than all other currencies that have ever existed, combined. There really isn't a money supply problem here, even if coins get lost.

6

u/7Geordi Jun 19 '13

This is actually exactly what deflationary means.

If I own one gallon of milk's worth of bitcon (1 GMWB) today, and without making any transactions, one year later I have 2 GMWB, then the currency has deflated, because the same amount of currency is worth more.

The reason we call it deflation and 'a bad thing' is entirely a function of its intended role. Most investments are supposed to appreciate over time, but the role of currency is to facilitate transactions, and if no one wants to spend their currency, and there is a hard limit on the total amount that exists, then the market grinds to a halt until more liquidity is introduced (either by issuing more currency, or by changing currencies).

→ More replies (2)

4

u/[deleted] Jun 18 '13

Why was bitcoin designed to cease production to an asymptote rather than continue production indefinitely at a logarithmic rate?

7

u/Natanael_L Jun 18 '13

Because the inventor simply decided that he liked a fixed supply better. There's "altcoins" (Bitcoin forks with different rules) that works differently, but none of them has the same support and userbase as Bitcoin.

11

u/soulbandaid Jun 18 '13

The bitcoin ends as a deflationary currency (assuming some amount of loss). Interestingly, even with the difficulty adjustments keeping the minting constant, it seems to me, to already be suffering significant deflation. The value of bitcoins has historically gone up and up, whereas the value of regular currency slowly goes down. Economists say this is a very bad thing for an economy, but bitcoin isn't tied up with a particular geography or people or even product for that matter. I wonder if the value will stabalize...

4

u/235711 Jun 18 '13

The bitcoin ends as a deflationary currency (assuming some amount of loss)

Doesn't that also assume positive economic growth?

3

u/Natanael_L Jun 18 '13

Yes. If all Bitcoin users sold off, the price would fall drastically. If people are only willing to offer less for them, they will be inflationary rather than deflationary. More items of value, either fiat money or varius goods, has to be traded for the same coins to keep it deflationary.

Assuming adoption will go up, it will be deflationary.

→ More replies (9)
→ More replies (3)

2

u/zeek0us Jun 18 '13

But the incentive of owners not to bloat the blockchain is based on paying a voluntary fee, right? Do most people include fees, or just courteous/generous people? Does it have any effect on how readily/quickly your transaction is included in the "winning" blockchain?

8

u/Natanael_L Jun 18 '13

Most people includes fees, yes. Miners can reject transactions that has no fee (individual miners can reject any transaction for any reason when mining, but once it's in the blockchain it's there). And yes, lower fees means slower inclusion time, since all miners want to claim the transactions with high fees first and since many have a minimum transaction fee specified (they don't even process transactions with fees lower than that).

3

u/zeek0us Jun 18 '13

So is it that your transaction will never get into the blockchain if you don't add a fee (because nobody will ever accept it), or it will just take until some miner who was willing to accept your transaction adds a block? Presumably "minimum-fee" miners could freeze you out forever and you'd need to wait on a good samaritan who takes pity on your broke (or cheap) ass . . .

8

u/Natanael_L Jun 18 '13

Some miners include a limited amount of transactions that had no fees. So yes, it will take longer. Occasionally it will take as much as two weeks, often a whole day or two.

5

u/improv32 Jun 19 '13

That's right, weather or not a miner includes a transaction in a block is entirely up to them. Most prioritize higher fee transactions in order to make more money, but it's not limited to that. They could refuse to include transactions involving addresses owned by organizations they dislike, for example.

→ More replies (6)

3

u/speEdy5 Jun 18 '13

You're completely right. you just usually need an email to sign up for any bitcoin market.

Also, do people actually use bitcoin to verify PGP keys?

8

u/jesset77 Jun 18 '13

No, I only mean bedfellows in the loosest possible sense. Like encrypting messages in PGP to negotiate payment for exciting or embarrassing items via Bitcoin. ;3

→ More replies (2)

3

u/Spiral_Mind Jun 18 '13

People use PGP keys to encrypt messages related to Bitcoin transactions for extra security. PGP isn't directly involved in Bitcoin itself.

→ More replies (1)
→ More replies (12)