{"id":338,"date":"2012-09-16T01:00:00","date_gmt":"2012-09-15T23:00:00","guid":{"rendered":"https:\/\/www.fussylogic.co.uk\/blog\/?p=338"},"modified":"2012-11-17T10:46:51","modified_gmt":"2012-11-17T10:46:51","slug":"bitcoin-explained-iv","status":"publish","type":"post","link":"https:\/\/www.fussylogic.co.uk\/blog\/?p=338","title":{"rendered":"Bitcoin Explained (IV)"},"content":{"rendered":"<p>This is <a href=\"?p=338\">part IV<\/a> in my \u00e2\u20ac\u0153Bitcoin Explained\u00e2\u20ac\u009d series.<\/p>\n<p>At the end of <a href=\"?p=335\">part III<\/a> we saw that the Bitcoin network\u00e2\u20ac\u2122s primary function is to act as a peer to peer timestamping system. That the blocks could, in principle, verify any data its operators wished.<\/p>\n<p>The catch of course is that those operators need an incentive to operate that system. There is nowhere near enough demand for verifying lost works of copyright music, photographs of cheques, or preventing contract fraud to encourage people to dedicate their computing resources to running such a timestamping network. In that sense then, it is absolutely necessary that the primary application for a peer to peer timestamping system like Bitcoin must be financial. What\u00e2\u20ac\u2122s more, some of that finance must be diverted to the node operators; or more particularly, the miners (the non-miners in the network are connected for their own benefit\/interest, rather than for monetary reward).<\/p>\n<p>We\u00e2\u20ac\u2122re therefore going to move on to talking about how the Bitcoin block chain is used to implement the bitcoin currency. We\u00e2\u20ac\u2122re going to be concerned almost entirely with the payload part of the blocks now; with only the connection between block and payload relevant to us. The payload of the Bitcoin block chain\u00e2\u20ac\u2122s block is a list of bitcoin transactions. A hash (of special type) of that payload is included in the block header \u00e2\u20ac\u201d no more. From a certain perspective, the block payload is <em>only<\/em> that special hash; but as a convenience the entire list of transactions is available from the nodes as well.<\/p>\n<p>Let\u00e2\u20ac\u2122s get the reward out of the way quickly. Being the creator of a block gets you one special ability that nobody else has. You gain the ability to write the first entry in the transaction list <em>and<\/em> you get to write it as a special type of transaction; one that generates coins from nowhere (for now). That then is your incentive to contribute your computing power to the network: if you are the miner that finds the block, you get to keep those freshly generated coins. Now: you can\u00e2\u20ac\u2122t just generate any number of coins you like, the other nodes in the network will simply reject your block. You can (for now) give yourself fifty coins. There is more to say on this, but it can wait until a later article; all we need for now is that there is an incentive, and simultaneously (and more importantly) a way in which new coins enter the bitcoin economy.<\/p>\n<p>Let\u00e2\u20ac\u2122s leave Bitcoin for a little while, and talk about public key cryptography. In particular cryptographic signatures. Digital signatures and public key encryption go mathematically hand in hand. Public key cryptography is typified (regardless of the underlying mathematics) by having two-part keys: a public part and a private part. These two parts are inseparably joined, they are only valid as a pair. There is no particular mystique about them, fundamentally they are two long numbers. Usually long numbers like these are represented using hexadecimal for computer systems; so they look scary to non-computer scientists. You shouldn\u00e2\u20ac\u2122t be scared: they really are just numbers, and in general the user doesn\u00e2\u20ac\u2122t have much to do with them \u00e2\u20ac\u201d they\u00e2\u20ac\u2122re usually just stored in a file. From a user perspective though, here\u00e2\u20ac\u2122s what you need to know:<\/p>\n<ul>\n<li>A public key can be used to <em>encrypt<\/em> a message such that only the person with the matching private key can decrypt that message.<\/li>\n<li>A private key can be used to <em>sign<\/em> a message such that anyone with the matching public key can verify that the matching private key was used to make the signature.<\/li>\n<\/ul>\n<p>Bitcoin makes no use whatsoever of <em>encryption<\/em>. It is entirely based on digital signatures. It has to be: it is a public record, not a public store of private records. These signatures, to any reasonable degree of confidence, are unfakeable. The mathematics of why this is so is beyond the scope of these articles, but be aware that all your banking, secure internet browsing, chip and pin credit cards and digital television content protection work off exactly the same bits of mathematics: trust me, they are unfakeable.<\/p>\n<hr \/>\n<p>Imagine that real-world signatures were as unfakeable as digital signatures. Imagine a bit of paper with a serial number and the message \u00e2\u20ac\u0153I will pay the owner 50 govcoins worth of gold\u00e2\u20ac\u009d written on. Further pretend for now that the Bank of England has some gold, and a trustworthy Governor. There is plenty of blank space on this paper. Imagine now that we run a chain of custody for money rather than the haphazard possession-is-ownership system we really have.<\/p>\n<p>Two pieces of paper come into your possession.<\/p>\n<pre><code>17283726152                17283726152\nI will pay the owner...    I will pay the owner...\n--------------------       --------------------\nAlice owns this            Alice owns this\n     signed Governor            signed Governor\nBob owns this              Bob owns this\n     signed Alice               signed Alice\nCharlie owns this          Charlie owns this\n     signed Bob                 signed Bob\nDave owns this             Dave owns this\n     signed Charlie             signed Charlie\nErnie owns this            Fred owns this\n     signed Dave                signed Gail\n<\/code><\/pre>\n<p>Both Fred and Ernie can prove their identity by creating a new signature in front of you. Would Harry take Fred\u00e2\u20ac\u2122s copy, or Ernie\u00e2\u20ac\u2122s copy as payment for a debt? Remember, signatures are unfakeable. Do you see the magic here? The paper is irrelevant, it can be stolen but ownership does not transfer with possession. It is the signature that is important. Think about what\u00e2\u20ac\u2122s going to go on the paper next:<\/p>\n<pre><code>17283726152                17283726152\nI will pay the owner...    I will pay the owner...\n--------------------       --------------------\nAlice owns this            Alice owns this\n     signed Governor            signed Governor\nBob owns this              Bob owns this\n     signed Alice               signed Alice\nCharlie owns this          Charlie owns this\n     signed Bob                 signed Bob\nDave owns this             Dave owns this\n     signed Charlie             signed Charlie\nErnie owns this            Fred owns this\n     signed Dave                signed Gail\nHarry owns this            Harry owns this\n     signed Ernie               signed Fred\n<\/code><\/pre>\n<p>Harry would be a fool to take Fred\u00e2\u20ac\u2122s signature on this paper; Fred\u00e2\u20ac\u2122s ownership is not part of the chain; Dave did not sign over ownership of this paper to Fred, he <em>did<\/em> sign it over to Ernie. Ernie is therefore entirely capable of signing it over to Harry. If anyone can verify a signature, then <em>anyone<\/em> can verify the ownership.<\/p>\n<p>Congratulations; you now understand Bitcoin transaction chains.<\/p>\n<hr \/>\n<p>A quick aside to cover some economic rather than technical issues:<\/p>\n<p>\u00e2\u20ac\u0153I will pay the owner 50 govcoins worth of gold\u00e2\u20ac\u009d<\/p>\n<p>What a sneaky devil I am. I\u00e2\u20ac\u2122m almost as bad as a government. What, exactly, is \u00e2\u20ac\u015350 govcoins worth of gold\u00e2\u20ac\u009d? I didn\u00e2\u20ac\u2122t say 50oz of gold, or $23 worth of gold. The answer is: whatever amount you can get from the seller of the gold.<\/p>\n<p>What is a govcoin worth? Whatever you can get for it.<\/p>\n<p>What is a dollar worth? Whatever you can get for it.<\/p>\n<p>What is 50oz of gold worth? Whatever you can get for it.<\/p>\n<p>What is a bitcoin worth? Whatever you can get for it.<\/p>\n<hr \/>\n<p>Did you spot the hole in the system? Fred can\u00e2\u20ac\u2122t produce a valid signature chain just because he stole the paper, but any of the real owners can copy the paper, getting multiple copies of the valid signature chain.<\/p>\n<pre><code>17283726152                17283726152\nI will pay the owner...    I will pay the owner...\n--------------------       --------------------\nAlice owns this            Alice owns this\n     signed Governor            signed Governor\nBob owns this              Bob owns this\n     signed Alice               signed Alice\nCharlie owns this          Charlie owns this\n     signed Bob                 signed Bob\nDave owns this             Dave owns this\n     signed Charlie             signed Charlie\nErnie owns this            Ernie owns this\n     signed Dave                signed Dave\nHarry owns this            Harry owns this\n     signed Ernie               signed Ernie\n<\/code><\/pre>\n<p>If Harry walks in to two different shops; what stops him signing these two copies over to two different people? As it stands, nothing.<\/p>\n<p>We\u00e2\u20ac\u2122ll talk about this problem in <a href=\"?p=341\">part V<\/a>, when we\u00e2\u20ac\u2122ll discuss <em>double spending<\/em>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is part IV in my \u00e2\u20ac\u0153Bitcoin Explained\u00e2\u20ac\u009d series. At the end of part III we saw that the Bitcoin network\u00e2\u20ac\u2122s primary function is to act as a peer to peer timestamping system. That the blocks could, in principle, verify any data its operators wished. The catch of course is that those operators need an\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.fussylogic.co.uk\/blog\/?p=338\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[24,1,53],"tags":[20],"_links":{"self":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/338"}],"collection":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=338"}],"version-history":[{"count":9,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/338\/revisions"}],"predecessor-version":[{"id":954,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/338\/revisions\/954"}],"wp:attachment":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}