0xa80f68ca86a30a0596bfe9a7f2dd1ebf19d5b08fa3dd6d01ad4c449f3b40f863

Transaction

Succeeded
Ethereum
0x60806040
Txn fee 0.15011582 ETH
ETH
+$34.63
ETH
-$387.68

  • 0
    DEPLOYMENT
    GENESIS 0x60806040526004361061025f575f3560e01c80635de0f2a011610143578063a9059cbb116100b5578063c3f70b5211610079578063c3f70b52146108d6578063…
    • 1
      SLOAD
    • 2
      SHA3
      0x0000000000000000000000000000000000000000000000000000000000000006
       
      0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f
    • 3
      SSTORE
      _name[0] "" to "Bitcoin As A State Transition Sy"
    • 4
      SSTORE
      _name[1] "" to "stem From a technical standp"
    • 5
      SSTORE
      _name[2] "" to "oint, the ledger of a cryptocurr"
    • 6
      SSTORE
      _name[3] "" to "ency such as Bitcoin can be thou"
    • 7
      SSTORE
      _name[4] "" to "ght of as a state transition sys"
    • 8
      SSTORE
      _name[5] "" to "tem, where there is a *state* co"
    • 9
      SSTORE
      _name[6] "" to "nsisting of the ownership status"
    • 10
      SSTORE
      _name[7] "" to " of all existing bitcoins and a "
    • 11
      SSTORE
      _name[8] "" to "*state transition function* that"
    • 12
      SSTORE
      _name[9] "" to " takes a state and a transaction"
    • 13
      SSTORE
      _name[10] "" to " and outputs a new state which i"
    • 14
      SSTORE
      _name[11] "" to "s the result. In a standard bank"
    • 15
      SSTORE
      _name[12] "" to "ing system, for example, the sta"
    • 16
      SSTORE
      _name[13] "" to "te is a balance sheet, a transac"
    • 17
      SSTORE
      _name[14] "" to "tion is a request to move $X fro"
    • 18
      SSTORE
      _name[15] "" to "m A to B, and the state transiti"
    • 19
      SSTORE
      _name[16] "" to "on function reduces the value in"
    • 20
      SSTORE
      _name[17] "" to " A's account by $X and increases"
    • 21
      SSTORE
      _name[18] "" to " the value in B's account by $X."
    • 22
      SSTORE
      _name[19] "" to " If A's account has less than $X"
    • 23
      SSTORE
      _name[20] "" to " in the first place, the state t"
    • 24
      SSTORE
      _name[21] "" to "ransition function returns an er"
    • 25
      SSTORE
      _name[22] "" to "ror. Hence, one can formally def"
    • 26
      SSTORE
      _name[23] "" to "ine: The *state* in Bitcoin is"
    • 27
      SSTORE
      _name[24] "" to " the collection of all coins (te"
    • 28
      SSTORE
      _name[25] "" to "chnically, *unspent transaction "
    • 29
      SSTORE
      _name[26] "" to "outputs* or UTXO) that have been"
    • 30
      SSTORE
      _name[27] "" to " minted and not yet spent, with "
    • 31
      SSTORE
      _name[28] "" to "each UTXO having a denomination "
    • 32
      SSTORE
      _name[29] "" to "and an owner (defined by a 20-by"
    • 33
      SSTORE
      _name[30] "" to "te address which is essentially "
    • 34
      SSTORE
      _name[31] "" to "a cryptographic public keyfn1). "
    • 35
      SSTORE
      _name[32] "" to "A transaction contains one or mo"
    • 36
      SSTORE
      _name[33] "" to "re inputs, with each input conta"
    • 37
      SSTORE
      _name[34] "" to "ining a reference to an existing"
    • 38
      SSTORE
      _name[35] "" to " UTXO and a cryptographic signat"
    • 39
      SSTORE
      _name[36] "" to "ure produced by the private key "
    • 40
      SSTORE
      _name[37] "" to "associated with the owner's addr"
    • 41
      SSTORE
      _name[38] "" to "ess, and one or more outputs, wi"
    • 42
      SSTORE
      _name[39] "" to "th each output containing a new "
    • 43
      SSTORE
      _name[40] "" to "UTXO to be added to the state. T"
    • 44
      SSTORE
      _name[41] "" to "he state transition function APP"
    • 45
      SSTORE
      _name[42] "" to "LY(S,TX) -> S' can be defined ro"
    • 46
      SSTORE
      _name[43] "" to "ughly as follows: For each input"
    • 47
      SSTORE
      _name[44] "" to " in TX: If the referenced UTXO i"
    • 48
      SSTORE
      _name[45] "" to "s not in S, return an error. If "
    • 49
      SSTORE
      _name[46] "" to "the provided signature does not "
    • 50
      SSTORE
      _name[47] "" to "match the owner of the UTXO, ret"
    • 51
      SSTORE
      _name[48] "" to "urn an error. If the sum of the "
    • 52
      SSTORE
      _name[49] "" to "denominations of all input UTXO "
    • 53
      SSTORE
      _name[50] "" to "is less than the sum of the deno"
    • 54
      SSTORE
      _name[51] "" to "minations of all output UTXO, re"
    • 55
      SSTORE
      _name[52] "" to "turn an error. Return S with all"
    • 56
      SSTORE
      _name[53] "" to " input UTXO removed and all outp"
    • 57
      SSTORE
      _name[54] "" to "ut UTXO added The first half of "
    • 58
      SSTORE
      _name[55] "" to "the first step prevents transact"
    • 59
      SSTORE
      _name[56] "" to "ion senders from spending coins "
    • 60
      SSTORE
      _name[57] "" to "that do not exist, the second ha"
    • 61
      SSTORE
      _name[58] "" to "lf of the first step prevents tr"
    • 62
      SSTORE
      _name[59] "" to "ansaction senders from spending "
    • 63
      SSTORE
      _name[60] "" to "other people's coins, and the se"
    • 64
      SSTORE
      _name[61] "" to "cond step enforces conservation "
    • 65
      SSTORE
      _name[62] "" to "of value. In order to use this f"
    • 66
      SSTORE
      _name[63] "" to "or payment, the protocol is as f"
    • 67
      SSTORE
      _name[64] "" to "ollows. Suppose Alice wants to s"
    • 68
      SSTORE
      _name[65] "" to "end 11.7 BTC to Bob. First, Alic"
    • 69
      SSTORE
      _name[66] "" to "e will look for a set of availab"
    • 70
      SSTORE
      _name[67] "" to "le UTXO that she owns that total"
    • 71
      SSTORE
      _name[68] "" to "s up to at least 11.7 BTC. Reali"
    • 72
      SSTORE
      _name[69] "" to "stically, Alice will not be able"
    • 73
      SSTORE
      _name[70] "" to " to get exactly 11.7 BTC; say th"
    • 74
      SSTORE
      _name[71] "" to "at the smallest she can get is 6"
    • 75
      SSTORE
      _name[72] "" to "+4+2=12. She then creates a tran"
    • 76
      SSTORE
      _name[73] "" to "saction with those three inputs "
    • 77
      SSTORE
      _name[74] "" to "and two outputs. The first outpu"
    • 78
      SSTORE
      _name[75] "" to "t will be 11.7 BTC with Bob's ad"
    • 79
      SSTORE
      _name[76] "" to "dress as its owner, and the seco"
    • 80
      SSTORE
      _name[77] "" to "nd output will be the remaining "
    • 81
      SSTORE
      _name[78] "" to "0.3 BTC *change*, with the owner"
    • 82
      SSTORE
      _name[79] "" to " being Alice herself. Minin"
    • 83
      SSTORE
      _name[80] "" to "g If we had access to a trus"
    • 84
      SSTORE
      _name[81] "" to "tworthy centralized service, thi"
    • 85
      SSTORE
      _name[82] "" to "s system would be trivial to imp"
    • 86
      SSTORE
      _name[83] "" to "lement; it could simply be coded"
    • 87
      SSTORE
      _name[84] "" to " exactly as described, using a c"
    • 88
      SSTORE
      _name[85] "" to "entralized server's hard drive t"
    • 89
      SSTORE
      _name[86] "" to "o keep track of the state. Howev"
    • 90
      SSTORE
      _name[87] "" to "er, with Bitcoin we are trying t"
    • 91
      SSTORE
      _name[88] "" to "o build a decentralized currency"
    • 92
      SSTORE
      _name[89] "" to " system, so we will need to comb"
    • 93
      SSTORE
      _name[90] "" to "ine the state transaction system"
    • 94
      SSTORE
      _name[91] "" to " with a consensus system in orde"
    • 95
      SSTORE
      _name[92] "" to "r to ensure that everyone agrees"
    • 96
      SSTORE
      _name[93] "" to " on the order of transactions. B"
    • 97
      SSTORE
      _name[94] "" to "itcoin's decentralized consensus"
    • 98
      SSTORE
      _name[95] "" to " process requires nodes in the n"
    • 99
      SSTORE
      _name[96] "" to "etwork to continuously attempt t"
    • 100
      SSTORE
      _name[97] "" to "o produce packages of transactio"
    • 101
      SSTORE
      _name[98] "" to "ns called *blocks*. The network "
    • 102
      SSTORE
      _name[99] "" to "is intended to produce roughly o"
    • 103
      SSTORE
      _name[100] "" to "ne block every ten minutes, with"
    • 104
      SSTORE
      _name[101] "" to " each block containing a timesta"
    • 105
      SSTORE
      _name[102] "" to "mp, a nonce, a reference to (ie."
    • 106
      SSTORE
      _name[103] "" to " hash of) the previous block and"
    • 107
      SSTORE
      _name[104] "" to " a list of all of the transactio"
    • 108
      SSTORE
      _name[105] "" to "ns that have taken place since t"
    • 109
      SSTORE
      _name[106] "" to "he previous block. Over time, th"
    • 110
      SSTORE
      _name[107] "" to "is creates a persistent, ever-gr"
    • 111
      SSTORE
      _name[108] "" to "owing, *blockchain* that constan"
    • 112
      SSTORE
      _name[109] "" to "tly updates to represent the lat"
    • 113
      SSTORE
      _name[110] "" to "est state of the Bitcoin ledger."
    • 114
      SSTORE
      _name[111] "" to " The algorithm for checking if a"
    • 115
      SSTORE
      _name[112] "" to " block is valid, expressed in th"
    • 116
      SSTORE
      _name[113] "" to "is paradigm, is as follows: Chec"
    • 117
      SSTORE
      _name[114] "" to "k if the previous block referenc"
    • 118
      SSTORE
      _name[115] "" to "ed by the block exists and is va"
    • 119
      SSTORE
      _name[116] "" to "lid. Check that the timestamp of"
    • 120
      SSTORE
      _name[117] "" to " the block is greater than that "
    • 121
      SSTORE
      _name[118] "" to "of the previous blockfn2 and les"
    • 122
      SSTORE
      _name[119] "" to "s than 2 hours into the future C"
    • 123
      SSTORE
      _name[120] "" to "heck that the proof-of-work on t"
    • 124
      SSTORE
      _name[121] "" to "he block is valid. Let S[0] be t"
    • 125
      SSTORE
      _name[122] "" to "he state at the end of the previ"
    • 126
      SSTORE
      _name[123] "" to "ous block. Suppose TX is the blo"
    • 127
      SSTORE
      _name[124] "" to "ck's transaction list with n tra"
    • 128
      SSTORE
      _name[125] "" to "nsactions. For all i in 0...n-1,"
    • 129
      SSTORE
      _name[126] "" to " set S[i+1] = APPLY(S[i],TX[i]) "
    • 130
      SSTORE
      _name[127] "" to "If any application returns an er"
    • 131
      SSTORE
      _name[128] "" to "ror, exit and return false. Retu"
    • 132
      SSTORE
      _name[129] "" to "rn true, and register S[n] as th"
    • 133
      SSTORE
      _name[130] "" to "e state at the end of this block"
    • 134
      SSTORE
      _name[131] "" to ". Essentially, each transaction "
    • 135
      SSTORE
      _name[132] "" to "in the block must provide a vali"
    • 136
      SSTORE
      _name[133] "" to "d state transition from what was"
    • 137
      SSTORE
      _name[134] "" to " the canonical state before the "
    • 138
      SSTORE
      _name[135] "" to "transaction was executed to some"
    • 139
      SSTORE
      _name[136] "" to " new state. Note that the state "
    • 140
      SSTORE
      _name[137] "" to "is not encoded in the block in a"
    • 141
      SSTORE
      _name[138] "" to "ny way; it is purely an abstract"
    • 142
      SSTORE
      _name[139] "" to "ion to be remembered by the vali"
    • 143
      SSTORE
      _name[140] "" to "dating node and can only be (sec"
    • 144
      SSTORE
      _name[141] "" to "urely) computed for any block by"
    • 145
      SSTORE
      _name[142] "" to " starting from the genesis state"
    • 146
      SSTORE
      _name[143] "" to " and sequentially applying every"
    • 147
      SSTORE
      _name[144] "" to " transaction in every block. Add"
    • 148
      SSTORE
      _name[145] "" to "itionally, note that the order i"
    • 149
      SSTORE
      _name[146] "" to "n which the miner includes trans"
    • 150
      SSTORE
      _name[147] "" to "actions into the block matters; "
    • 151
      SSTORE
      _name[148] "" to "if there are two transactions A "
    • 152
      SSTORE
      _name[149] "" to "and B in a block such that B spe"
    • 153
      SSTORE
      _name[150] "" to "nds a UTXO created by A, then th"
    • 154
      SSTORE
      _name[151] "" to "e block will be valid if A comes"
    • 155
      SSTORE
      _name[152] "" to " before B but not otherwise. The"
    • 156
      SSTORE
      _name[153] "" to " one validity condition present "
    • 157
      SSTORE
      _name[154] "" to "in the above list that is not fo"
    • 158
      SSTORE
      _name[155] "" to "und in other systems is the requ"
    • 159
      SSTORE
      _name[156] "" to "irement for *proof-of-work*. The"
    • 160
      SSTORE
      _name[157] "" to " precise condition is that the d"
    • 161
      SSTORE
      _name[158] "" to "ouble-SHA256 hash of every block"
    • 162
      SSTORE
      _name[159] "" to ", treated as a 256-bit number, m"
    • 163
      SSTORE
      _name[160] "" to "ust be less than a dynamically a"
    • 164
      SSTORE
      _name[161] "" to "djusted target, which as of the "
    • 165
      SSTORE
      _name[162] "" to "time of this writing is approxim"
    • 166
      SSTORE
      _name[163] "" to "ately 2187. The purpose of this "
    • 167
      SSTORE
      _name[164] "" to "is to make block creation comput"
    • 168
      SSTORE
      _name[165] "" to "ationally *hard*, thereby preven"
    • 169
      SSTORE
      _name[166] "" to "ting sybil attackers from remaki"
    • 170
      SSTORE
      _name[167] "" to "ng the entire blockchain in thei"
    • 171
      SSTORE
      _name[168] "" to "r favor. Because SHA256 is desig"
    • 172
      SSTORE
      _name[169] "" to "ned to be a completely unpredict"
    • 173
      SSTORE
      _name[170] "" to "able pseudorandom function, the "
    • 174
      SSTORE
      _name[171] "" to "only way to create a valid block"
    • 175
      SSTORE
      _name[172] "" to " is simply trial and error, repe"
    • 176
      SSTORE
      _name[173] "" to "atedly incrementing the nonce an"
    • 177
      SSTORE
      _name[174] "" to "d seeing if the new hash matches"
    • 178
      SSTORE
      _name[175] "" to ". At the current target of ~2187"
    • 179
      SSTORE
      _name[176] "" to ", the network must make an avera"
    • 180
      SSTORE
      _name[177] "" to "ge of ~269 tries before a valid "
    • 181
      SSTORE
      _name[178] "" to "block is found; in general, the "
    • 182
      SSTORE
      _name[179] "" to "target is recalibrated by the ne"
    • 183
      SSTORE
      _name[180] "" to "twork every 2016 blocks so that "
    • 184
      SSTORE
      _name[181] "" to "on average a new block is produc"
    • 185
      SSTORE
      _name[182] "" to "ed by some node in the network e"
    • 186
      SSTORE
      _name[183] "" to "very ten minutes. In order to co"
    • 187
      SSTORE
      _name[184] "" to "mpensate miners for this computa"
    • 188
      SSTORE
      _name[185] "" to "tional work, the miner of every "
    • 189
      SSTORE
      _name[186] "" to "block is entitled to include a t"
    • 190
      SSTORE
      _name[187] "" to "ransaction giving themselves 25 "
    • 191
      SSTORE
      _name[188] "" to "BTC out of nowhere. Additionally"
    • 192
      SSTORE
      _name[189] "" to ", if any transaction has a highe"
    • 193
      SSTORE
      _name[190] "" to "r total denomination in its inpu"
    • 194
      SSTORE
      _name[191] "" to "ts than in its outputs, the diff"
    • 195
      SSTORE
      _name[192] "" to "erence also goes to the miner as"
    • 196
      SSTORE
      _name[193] "" to " a *transaction fee*. Incidental"
    • 197
      SSTORE
      _name[194] "" to "ly, this is also the only mechan"
    • 198
      SSTORE
      _name[195] "" to "ism by which BTC are issued; the"
    • 199
      SSTORE
      _name[196] "" to " genesis state contained no coin"
    • 200
      SSTORE
      _name[197] "" to "s at all. In order to better und"
    • 201
      SSTORE
      _name[198] "" to "erstand the purpose of mining, l"
    • 202
      SSTORE
      _name[199] "" to "et us examine what happens in th"
    • 203
      SSTORE
      _name[200] "" to "e event of a malicious attacker."
    • 204
      SSTORE
      _name[201] "" to " Since Bitcoin's underlying cryp"
    • 205
      SSTORE
      _name[202] "" to "tography is known to be secure, "
    • 206
      SSTORE
      _name[203] "" to "the attacker will target the one"
    • 207
      SSTORE
      _name[204] "" to " part of the Bitcoin system that"
    • 208
      SSTORE
      _name[205] "" to " is not protected by cryptograph"
    • 209
      SSTORE
      _name[206] "" to "y directly: the order of transac"
    • 210
      SSTORE
      _name[207] "" to "tions. The attacker's strategy i"
    • 211
      SSTORE
      _name[208] "" to "s simple: Send 100 BTC to a merc"
    • 212
      SSTORE
      _name[209] "" to "hant in exchange for some produc"
    • 213
      SSTORE
      _name[210] "" to "t (preferably a rapid-delivery d"
    • 214
      SSTORE
      _name[211] "" to "igital good) ait for the deliver"
    • 215
      SSTORE
      _name[212] "" to "y of the product Produce another"
    • 216
      SSTORE
      _name[213] "" to " transaction sending the same 10"
    • 217
      SSTORE
      _name[214] "" to "0 BTC to himself Try to convince"
    • 218
      SSTORE
      _name[215] "" to " the network that his transactio"
    • 219
      SSTORE
      _name[216] "" to "n to himself was the one that ca"
    • 220
      SSTORE
      _name[217] "" to "me first. Once step (1) has take"
    • 221
      SSTORE
      _name[218] "" to "n place, after a few minutes som"
    • 222
      SSTORE
      _name[219] "" to "e miner will include the transac"
    • 223
      SSTORE
      _name[220] "" to "tion in a block, say block numbe"
    • 224
      SSTORE
      _name[221] "" to "r 270000. After about one hour, "
    • 225
      SSTORE
      _name[222] "" to "five more blocks will have been "
    • 226
      SSTORE
      _name[223] "" to "added to the chain after that bl"
    • 227
      SSTORE
      _name[224] "" to "ock, with each of those blocks i"
    • 228
      SSTORE
      _name[225] "" to "ndirectly pointing to the transa"
    • 229
      SSTORE
      _name[226] "" to "ction and thus *confirming* it. "
    • 230
      SSTORE
      _name[227] "" to "At this point, the merchant will"
    • 231
      SSTORE
      _name[228] "" to " accept the payment as finalized"
    • 232
      SSTORE
      _name[229] "" to " and deliver the product; since "
    • 233
      SSTORE
      _name[230] "" to "we are assuming this is a digita"
    • 234
      SSTORE
      _name[231] "" to "l good, delivery is instant. Now"
    • 235
      SSTORE
      _name[232] "" to ", the attacker creates another t"
    • 236
      SSTORE
      _name[233] "" to "ransaction sending the 100 BTC t"
    • 237
      SSTORE
      _name[234] "" to "o himself. If the attacker simpl"
    • 238
      SSTORE
      _name[235] "" to "y releases it into the wild, the"
    • 239
      SSTORE
      _name[236] "" to " transaction will not be process"
    • 240
      SSTORE
      _name[237] "" to "ed; miners will attempt to run A"
    • 241
      SSTORE
      _name[238] "" to "PPLY(S,TX) and notice that TX co"
    • 242
      SSTORE
      _name[239] "" to "nsumes a UTXO which is no longer"
    • 243
      SSTORE
      _name[240] "" to " in the state. So instead, the a"
    • 244
      SSTORE
      _name[241] "" to "ttacker creates a *fork* of the "
    • 245
      SSTORE
      _name[242] "" to "blockchain, starting by mining a"
    • 246
      SSTORE
      _name[243] "" to "nother version of block 270000 p"
    • 247
      SSTORE
      _name[244] "" to "ointing to the same block 269999"
    • 248
      SSTORE
      _name[245] "" to " as a parent but with the new tr"
    • 249
      SSTORE
      _name[246] "" to "ansaction in place of the old on"
    • 250
      SSTORE
      _name[247] "" to "e. Because the block data is dif"
    • 251
      SSTORE
      _name[248] "" to "ferent, this requires redoing th"
    • 252
      SSTORE
      _name[249] "" to "e proof-of-work. Furthermore, th"
    • 253
      SSTORE
      _name[250] "" to "e attacker's new version of bloc"
    • 254
      SSTORE
      _name[251] "" to "k 270000 has a different hash, s"
    • 255
      SSTORE
      _name[252] "" to "o the original blocks 270001 to "
    • 256
      SSTORE
      _name[253] "" to "270005 do not *point* to it; thu"
    • 257
      SSTORE
      _name[254] "" to "s, the original chain and the at"
    • 258
      SSTORE
      _name[255] "" to "tacker's new chain are completel"
    • 259
      SSTORE
      _name[256] "" to "y separate. The rule is that in "
    • 260
      SSTORE
      _name[257] "" to "a fork the longest blockchain is"
    • 261
      SSTORE
      _name[258] "" to " taken to be the truth, and so l"
    • 262
      SSTORE
      _name[259] "" to "egitimate miners will work on th"
    • 263
      SSTORE
      _name[260] "" to "e 270005 chain while the attacke"
    • 264
      SSTORE
      _name[261] "" to "r alone is working on the 270000"
    • 265
      SSTORE
      _name[262] "" to " chain. In order for the attacke"
    • 266
      SSTORE
      _name[263] "" to "r to make his blockchain the lon"
    • 267
      SSTORE
      _name[264] "" to "gest, he would need to have more"
    • 268
      SSTORE
      _name[265] "" to " computational power than the re"
    • 269
      SSTORE
      _name[266] "" to "st of the network combined in or"
    • 270
      SSTORE
      _name[267] "" to "der to catch up (hence, *51% att"
    • 271
      SSTORE
      _name[268] "" to "ack*)."
    • 272
      SSTORE
      _name[length] 0 to 6
    • 273
      SLOAD
    • 274
      SSTORE
      (_symbol[data], _symbol[length]) ("" to "GENESIS", 0 to 7)
    • 275
      SLOAD
      (areLimitsOn, emptyContractFull) (false, false)
    • 276
      SSTORE
      (areLimitsOn, emptyContractFull) (false to true, false)
    • 277
      SLOAD
      (areLimitsOn, emptyContractFull) (true, false)
    • 278
      SSTORE
      (areLimitsOn, emptyContractFull) (true, false)
    • 279
      SLOAD
    • 280
      SLOAD
    • 281
      SHA3
      0x0000000000000000000000000000000000000000000000000000000000000006
       
      0xf652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f
    • 282
      SLOAD
      _name[0] "Bitcoin As A State Transition Sy"
    • 283
      SLOAD
      _name[1] "stem From a technical standp"
    • 284
      SLOAD
      _name[2] "oint, the ledger of a cryptocurr"
    • 285
      SLOAD
      _name[3] "ency such as Bitcoin can be thou"
    • 286
      SLOAD
      _name[4] "ght of as a state transition sys"
    • 287
      SLOAD
      _name[5] "tem, where there is a *state* co"
    • 288
      SLOAD
      _name[6] "nsisting of the ownership status"
    • 289
      SLOAD
      _name[7] " of all existing bitcoins and a "
    • 290
      SLOAD
      _name[8] "*state transition function* that"
    • 291
      SLOAD
      _name[9] " takes a state and a transaction"
    • 292
      SLOAD
      _name[10] " and outputs a new state which i"
    • 293
      SLOAD
      _name[11] "s the result. In a standard bank"
    • 294
      SLOAD
      _name[12] "ing system, for example, the sta"
    • 295
      SLOAD
      _name[13] "te is a balance sheet, a transac"
    • 296
      SLOAD
      _name[14] "tion is a request to move $X fro"
    • 297
      SLOAD
      _name[15] "m A to B, and the state transiti"
    • 298
      SLOAD
      _name[16] "on function reduces the value in"
    • 299
      SLOAD
      _name[17] " A's account by $X and increases"
    • 300
      SLOAD
      _name[18] " the value in B's account by $X."
    • 301
      SLOAD
      _name[19] " If A's account has less than $X"
    • 302
      SLOAD
      _name[20] " in the first place, the state t"
    • 303
      SLOAD
      _name[21] "ransition function returns an er"
    • 304
      SLOAD
      _name[22] "ror. Hence, one can formally def"
    • 305
      SLOAD
      _name[23] "ine: The *state* in Bitcoin is"
    • 306
      SLOAD
      _name[24] " the collection of all coins (te"
    • 307
      SLOAD
      _name[25] "chnically, *unspent transaction "
    • 308
      SLOAD
      _name[26] "outputs* or UTXO) that have been"
    • 309
      SLOAD
      _name[27] " minted and not yet spent, with "
    • 310
      SLOAD
      _name[28] "each UTXO having a denomination "
    • 311
      SLOAD
      _name[29] "and an owner (defined by a 20-by"
    • 312
      SLOAD
      _name[30] "te address which is essentially "
    • 313
      SLOAD
      _name[31] "a cryptographic public keyfn1). "
    • 314
      SLOAD
      _name[32] "A transaction contains one or mo"
    • 315
      SLOAD
      _name[33] "re inputs, with each input conta"
    • 316
      SLOAD
      _name[34] "ining a reference to an existing"
    • 317
      SLOAD
      _name[35] " UTXO and a cryptographic signat"
    • 318
      SLOAD
      _name[36] "ure produced by the private key "
    • 319
      SLOAD
      _name[37] "associated with the owner's addr"
    • 320
      SLOAD
      _name[38] "ess, and one or more outputs, wi"
    • 321
      SLOAD
      _name[39] "th each output containing a new "
    • 322
      SLOAD
      _name[40] "UTXO to be added to the state. T"
    • 323
      SLOAD
      _name[41] "he state transition function APP"
    • 324
      SLOAD
      _name[42] "LY(S,TX) -> S' can be defined ro"
    • 325
      SLOAD
      _name[43] "ughly as follows: For each input"
    • 326
      SLOAD
      _name[44] " in TX: If the referenced UTXO i"
    • 327
      SLOAD
      _name[45] "s not in S, return an error. If "
    • 328
      SLOAD
      _name[46] "the provided signature does not "
    • 329
      SLOAD
      _name[47] "match the owner of the UTXO, ret"
    • 330
      SLOAD
      _name[48] "urn an error. If the sum of the "
    • 331
      SLOAD
      _name[49] "denominations of all input UTXO "
    • 332
      SLOAD
      _name[50] "is less than the sum of the deno"
    • 333
      SLOAD
      _name[51] "minations of all output UTXO, re"
    • 334
      SLOAD
      _name[52] "turn an error. Return S with all"
    • 335
      SLOAD
      _name[53] " input UTXO removed and all outp"
    • 336
      SLOAD
      _name[54] "ut UTXO added The first half of "
    • 337
      SLOAD
      _name[55] "the first step prevents transact"
    • 338
      SLOAD
      _name[56] "ion senders from spending coins "
    • 339
      SLOAD
      _name[57] "that do not exist, the second ha"
    • 340
      SLOAD
      _name[58] "lf of the first step prevents tr"
    • 341
      SLOAD
      _name[59] "ansaction senders from spending "
    • 342
      SLOAD
      _name[60] "other people's coins, and the se"
    • 343
      SLOAD
      _name[61] "cond step enforces conservation "
    • 344
      SLOAD
      _name[62] "of value. In order to use this f"
    • 345
      SLOAD
      _name[63] "or payment, the protocol is as f"
    • 346
      SLOAD
      _name[64] "ollows. Suppose Alice wants to s"
    • 347
      SLOAD
      _name[65] "end 11.7 BTC to Bob. First, Alic"
    • 348
      SLOAD
      _name[66] "e will look for a set of availab"
    • 349
      SLOAD
      _name[67] "le UTXO that she owns that total"
    • 350
      SLOAD
      _name[68] "s up to at least 11.7 BTC. Reali"
    • 351
      SLOAD
      _name[69] "stically, Alice will not be able"
    • 352
      SLOAD
      _name[70] " to get exactly 11.7 BTC; say th"
    • 353
      SLOAD
      _name[71] "at the smallest she can get is 6"
    • 354
      SLOAD
      _name[72] "+4+2=12. She then creates a tran"
    • 355
      SLOAD
      _name[73] "saction with those three inputs "
    • 356
      SLOAD
      _name[74] "and two outputs. The first outpu"
    • 357
      SLOAD
      _name[75] "t will be 11.7 BTC with Bob's ad"
    • 358
      SLOAD
      _name[76] "dress as its owner, and the seco"
    • 359
      SLOAD
      _name[77] "nd output will be the remaining "
    • 360
      SLOAD
      _name[78] "0.3 BTC *change*, with the owner"
    • 361
      SLOAD
      _name[79] " being Alice herself. Minin"
    • 362
      SLOAD
      _name[80] "g If we had access to a trus"
    • 363
      SLOAD
      _name[81] "tworthy centralized service, thi"
    • 364
      SLOAD
      _name[82] "s system would be trivial to imp"
    • 365
      SLOAD
      _name[83] "lement; it could simply be coded"
    • 366
      SLOAD
      _name[84] " exactly as described, using a c"
    • 367
      SLOAD
      _name[85] "entralized server's hard drive t"
    • 368
      SLOAD
      _name[86] "o keep track of the state. Howev"
    • 369
      SLOAD
      _name[87] "er, with Bitcoin we are trying t"
    • 370
      SLOAD
      _name[88] "o build a decentralized currency"
    • 371
      SLOAD
      _name[89] " system, so we will need to comb"
    • 372
      SLOAD
      _name[90] "ine the state transaction system"
    • 373
      SLOAD
      _name[91] " with a consensus system in orde"
    • 374
      SLOAD
      _name[92] "r to ensure that everyone agrees"
    • 375
      SLOAD
      _name[93] " on the order of transactions. B"
    • 376
      SLOAD
      _name[94] "itcoin's decentralized consensus"
    • 377
      SLOAD
      _name[95] " process requires nodes in the n"
    • 378
      SLOAD
      _name[96] "etwork to continuously attempt t"
    • 379
      SLOAD
      _name[97] "o produce packages of transactio"
    • 380
      SLOAD
      _name[98] "ns called *blocks*. The network "
    • 381
      SLOAD
      _name[99] "is intended to produce roughly o"
    • 382
      SLOAD
      _name[100] "ne block every ten minutes, with"
    • 383
      SLOAD
      _name[101] " each block containing a timesta"
    • 384
      SLOAD
      _name[102] "mp, a nonce, a reference to (ie."
    • 385
      SLOAD
      _name[103] " hash of) the previous block and"
    • 386
      SLOAD
      _name[104] " a list of all of the transactio"
    • 387
      SLOAD
      _name[105] "ns that have taken place since t"
    • 388
      SLOAD
      _name[106] "he previous block. Over time, th"
    • 389
      SLOAD
      _name[107] "is creates a persistent, ever-gr"
    • 390
      SLOAD
      _name[108] "owing, *blockchain* that constan"
    • 391
      SLOAD
      _name[109] "tly updates to represent the lat"
    • 392
      SLOAD
      _name[110] "est state of the Bitcoin ledger."
    • 393
      SLOAD
      _name[111] " The algorithm for checking if a"
    • 394
      SLOAD
      _name[112] " block is valid, expressed in th"
    • 395
      SLOAD
      _name[113] "is paradigm, is as follows: Chec"
    • 396
      SLOAD
      _name[114] "k if the previous block referenc"
    • 397
      SLOAD
      _name[115] "ed by the block exists and is va"
    • 398
      SLOAD
      _name[116] "lid. Check that the timestamp of"
    • 399
      SLOAD
      _name[117] " the block is greater than that "
    • 400
      SLOAD
      _name[118] "of the previous blockfn2 and les"
    • 401
      SLOAD
      _name[119] "s than 2 hours into the future C"
    • 402
      SLOAD
      _name[120] "heck that the proof-of-work on t"
    • 403
      SLOAD
      _name[121] "he block is valid. Let S[0] be t"
    • 404
      SLOAD
      _name[122] "he state at the end of the previ"
    • 405
      SLOAD
      _name[123] "ous block. Suppose TX is the blo"
    • 406
      SLOAD
      _name[124] "ck's transaction list with n tra"
    • 407
      SLOAD
      _name[125] "nsactions. For all i in 0...n-1,"
    • 408
      SLOAD
      _name[126] " set S[i+1] = APPLY(S[i],TX[i]) "
    • 409
      SLOAD
      _name[127] "If any application returns an er"
    • 410
      SLOAD
      _name[128] "ror, exit and return false. Retu"
    • 411
      SLOAD
      _name[129] "rn true, and register S[n] as th"
    • 412
      SLOAD
      _name[130] "e state at the end of this block"
    • 413
      SLOAD
      _name[131] ". Essentially, each transaction "
    • 414
      SLOAD
      _name[132] "in the block must provide a vali"
    • 415
      SLOAD
      _name[133] "d state transition from what was"
    • 416
      SLOAD
      _name[134] " the canonical state before the "
    • 417
      SLOAD
      _name[135] "transaction was executed to some"
    • 418
      SLOAD
      _name[136] " new state. Note that the state "
    • 419
      SLOAD
      _name[137] "is not encoded in the block in a"
    • 420
      SLOAD
      _name[138] "ny way; it is purely an abstract"
    • 421
      SLOAD
      _name[139] "ion to be remembered by the vali"
    • 422
      SLOAD
      _name[140] "dating node and can only be (sec"
    • 423
      SLOAD
      _name[141] "urely) computed for any block by"
    • 424
      SLOAD
      _name[142] " starting from the genesis state"
    • 425
      SLOAD
      _name[143] " and sequentially applying every"
    • 426
      SLOAD
      _name[144] " transaction in every block. Add"
    • 427
      SLOAD
      _name[145] "itionally, note that the order i"
    • 428
      SLOAD
      _name[146] "n which the miner includes trans"
    • 429
      SLOAD
      _name[147] "actions into the block matters; "
    • 430
      SLOAD
      _name[148] "if there are two transactions A "
    • 431
      SLOAD
      _name[149] "and B in a block such that B spe"
    • 432
      SLOAD
      _name[150] "nds a UTXO created by A, then th"
    • 433
      SLOAD
      _name[151] "e block will be valid if A comes"
    • 434
      SLOAD
      _name[152] " before B but not otherwise. The"
    • 435
      SLOAD
      _name[153] " one validity condition present "
    • 436
      SLOAD
      _name[154] "in the above list that is not fo"
    • 437
      SLOAD
      _name[155] "und in other systems is the requ"
    • 438
      SLOAD
      _name[156] "irement for *proof-of-work*. The"
    • 439
      SLOAD
      _name[157] " precise condition is that the d"
    • 440
      SLOAD
      _name[158] "ouble-SHA256 hash of every block"
    • 441
      SLOAD
      _name[159] ", treated as a 256-bit number, m"
    • 442
      SLOAD
      _name[160] "ust be less than a dynamically a"
    • 443
      SLOAD
      _name[161] "djusted target, which as of the "
    • 444
      SLOAD
      _name[162] "time of this writing is approxim"
    • 445
      SLOAD
      _name[163] "ately 2187. The purpose of this "
    • 446
      SLOAD
      _name[164] "is to make block creation comput"
    • 447
      SLOAD
      _name[165] "ationally *hard*, thereby preven"
    • 448
      SLOAD
      _name[166] "ting sybil attackers from remaki"
    • 449
      SLOAD
      _name[167] "ng the entire blockchain in thei"
    • 450
      SLOAD
      _name[168] "r favor. Because SHA256 is desig"
    • 451
      SLOAD
      _name[169] "ned to be a completely unpredict"
    • 452
      SLOAD
      _name[170] "able pseudorandom function, the "
    • 453
      SLOAD
      _name[171] "only way to create a valid block"
    • 454
      SLOAD
      _name[172] " is simply trial and error, repe"
    • 455
      SLOAD
      _name[173] "atedly incrementing the nonce an"
    • 456
      SLOAD
      _name[174] "d seeing if the new hash matches"
    • 457
      SLOAD
      _name[175] ". At the current target of ~2187"
    • 458
      SLOAD
      _name[176] ", the network must make an avera"
    • 459
      SLOAD
      _name[177] "ge of ~269 tries before a valid "
    • 460
      SLOAD
      _name[178] "block is found; in general, the "
    • 461
      SLOAD
      _name[179] "target is recalibrated by the ne"
    • 462
      SLOAD
      _name[180] "twork every 2016 blocks so that "
    • 463
      SLOAD
      _name[181] "on average a new block is produc"
    • 464
      SLOAD
      _name[182] "ed by some node in the network e"
    • 465
      SLOAD
      _name[183] "very ten minutes. In order to co"
    • 466
      SLOAD
      _name[184] "mpensate miners for this computa"
    • 467
      SLOAD
      _name[185] "tional work, the miner of every "
    • 468
      SLOAD
      _name[186] "block is entitled to include a t"
    • 469
      SLOAD
      _name[187] "ransaction giving themselves 25 "
    • 470
      SLOAD
      _name[188] "BTC out of nowhere. Additionally"
    • 471
      SLOAD
      _name[189] ", if any transaction has a highe"
    • 472
      SLOAD
      _name[190] "r total denomination in its inpu"
    • 473
      SLOAD
      _name[191] "ts than in its outputs, the diff"
    • 474
      SLOAD
      _name[192] "erence also goes to the miner as"
    • 475
      SLOAD
      _name[193] " a *transaction fee*. Incidental"
    • 476
      SLOAD
      _name[194] "ly, this is also the only mechan"
    • 477
      SLOAD
      _name[195] "ism by which BTC are issued; the"
    • 478
      SLOAD
      _name[196] " genesis state contained no coin"
    • 479
      SLOAD
      _name[197] "s at all. In order to better und"
    • 480
      SLOAD
      _name[198] "erstand the purpose of mining, l"
    • 481
      SLOAD
      _name[199] "et us examine what happens in th"
    • 482
      SLOAD
      _name[200] "e event of a malicious attacker."
    • 483
      SLOAD
      _name[201] " Since Bitcoin's underlying cryp"
    • 484
      SLOAD
      _name[202] "tography is known to be secure, "
    • 485
      SLOAD
      _name[203] "the attacker will target the one"
    • 486
      SLOAD
      _name[204] " part of the Bitcoin system that"
    • 487
      SLOAD
      _name[205] " is not protected by cryptograph"
    • 488
      SLOAD
      _name[206] "y directly: the order of transac"
    • 489
      SLOAD
      _name[207] "tions. The attacker's strategy i"
    • 490
      SLOAD
      _name[208] "s simple: Send 100 BTC to a merc"
    • 491
      SLOAD
      _name[209] "hant in exchange for some produc"
    • 492
      SLOAD
      _name[210] "t (preferably a rapid-delivery d"
    • 493
      SLOAD
      _name[211] "igital good) ait for the deliver"
    • 494
      SLOAD
      _name[212] "y of the product Produce another"
    • 495
      SLOAD
      _name[213] " transaction sending the same 10"
    • 496
      SLOAD
      _name[214] "0 BTC to himself Try to convince"
    • 497
      SLOAD
      _name[215] " the network that his transactio"
    • 498
      SLOAD
      _name[216] "n to himself was the one that ca"
    • 499
      SLOAD
      _name[217] "me first. Once step (1) has take"
    • 500
      SLOAD
      _name[218] "n place, after a few minutes som"
    • 501
      SLOAD
      _name[219] "e miner will include the transac"
    • 502
      SLOAD
      _name[220] "tion in a block, say block numbe"
    • 503
      SLOAD
      _name[221] "r 270000. After about one hour, "
    • 504
      SLOAD
      _name[222] "five more blocks will have been "
    • 505
      SLOAD
      _name[223] "added to the chain after that bl"
    • 506
      SLOAD
      _name[224] "ock, with each of those blocks i"
    • 507
      SLOAD
      _name[225] "ndirectly pointing to the transa"
    • 508
      SLOAD
      _name[226] "ction and thus *confirming* it. "
    • 509
      SLOAD
      _name[227] "At this point, the merchant will"
    • 510
      SLOAD
      _name[228] " accept the payment as finalized"
    • 511
      SLOAD
      _name[229] " and deliver the product; since "
    • 512
      SLOAD
      _name[230] "we are assuming this is a digita"
    • 513
      SLOAD
      _name[231] "l good, delivery is instant. Now"
    • 514
      SLOAD
      _name[232] ", the attacker creates another t"
    • 515
      SLOAD
      _name[233] "ransaction sending the 100 BTC t"
    • 516
      SLOAD
      _name[234] "o himself. If the attacker simpl"
    • 517
      SLOAD
      _name[235] "y releases it into the wild, the"
    • 518
      SLOAD
      _name[236] " transaction will not be process"
    • 519
      SLOAD
      _name[237] "ed; miners will attempt to run A"
    • 520
      SLOAD
      _name[238] "PPLY(S,TX) and notice that TX co"
    • 521
      SLOAD
      _name[239] "nsumes a UTXO which is no longer"
    • 522
      SLOAD
      _name[240] " in the state. So instead, the a"
    • 523
      SLOAD
      _name[241] "ttacker creates a *fork* of the "
    • 524
      SLOAD
      _name[242] "blockchain, starting by mining a"
    • 525
      SLOAD
      _name[243] "nother version of block 270000 p"
    • 526
      SLOAD
      _name[244] "ointing to the same block 269999"
    • 527
      SLOAD
      _name[245] " as a parent but with the new tr"
    • 528
      SLOAD
      _name[246] "ansaction in place of the old on"
    • 529
      SLOAD
      _name[247] "e. Because the block data is dif"
    • 530
      SLOAD
      _name[248] "ferent, this requires redoing th"
    • 531
      SLOAD
      _name[249] "e proof-of-work. Furthermore, th"
    • 532
      SLOAD
      _name[250] "e attacker's new version of bloc"
    • 533
      SLOAD
      _name[251] "k 270000 has a different hash, s"
    • 534
      SLOAD
      _name[252] "o the original blocks 270001 to "
    • 535
      SLOAD
      _name[253] "270005 do not *point* to it; thu"
    • 536
      SLOAD
      _name[254] "s, the original chain and the at"
    • 537
      SLOAD
      _name[255] "tacker's new chain are completel"
    • 538
      SLOAD
      _name[256] "y separate. The rule is that in "
    • 539
      SLOAD
      _name[257] "a fork the longest blockchain is"
    • 540
      SLOAD
      _name[258] " taken to be the truth, and so l"
    • 541
      SLOAD
      _name[259] "egitimate miners will work on th"
    • 542
      SLOAD
      _name[260] "e 270005 chain while the attacke"
    • 543
      SLOAD
      _name[261] "r alone is working on the 270000"
    • 544
      SLOAD
      _name[262] " chain. In order for the attacke"
    • 545
      SLOAD
      _name[263] "r to make his blockchain the lon"
    • 546
      SLOAD
      _name[264] "gest, he would need to have more"
    • 547
      SLOAD
      _name[265] " computational power than the re"
    • 548
      SLOAD
      _name[266] "st of the network combined in or"
    • 549
      SLOAD
      _name[267] "der to catch up (hence, *51% att"
    • 550
      SLOAD
      _name[268] "ack*)."
    • 551
      SLOAD
      (_symbol[data], _symbol[length]) ("GENESIS", 7)
    • 552
      SLOAD
      (_symbol[data], _symbol[length]) ("GENESIS", 7)
    • 553
      SLOAD
      (_symbol[data], _symbol[length]) ("GENESIS", 7)
    • 554
      SLOAD
    • 555
      SHA3
      0x0000000000000000000000000000000000000000000000000000000000000003
       
      0xc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b
    • 556
      SSTORE
      _name[0] "" to "Bitcoin As A State Transition Sy"
    • 557
      SSTORE
      _name[1] "" to "stem From a technical standp"
    • 558
      SSTORE
      _name[2] "" to "oint, the ledger of a cryptocurr"
    • 559
      SSTORE
      _name[3] "" to "ency such as Bitcoin can be thou"
    • 560
      SSTORE
      _name[4] "" to "ght of as a state transition sys"
    • 561
      SSTORE
      _name[5] "" to "tem, where there is a *state* co"
    • 562
      SSTORE
      _name[6] "" to "nsisting of the ownership status"
    • 563
      SSTORE
      _name[7] "" to " of all existing bitcoins and a "
    • 564
      SSTORE
      _name[8] "" to "*state transition function* that"
    • 565
      SSTORE
      _name[9] "" to " takes a state and a transaction"
    • 566
      SSTORE
      _name[10] "" to " and outputs a new state which i"
    • 567
      SSTORE
      _name[11] "" to "s the result. In a standard bank"
    • 568
      SSTORE
      _name[12] "" to "ing system, for example, the sta"
    • 569
      SSTORE
      _name[13] "" to "te is a balance sheet, a transac"
    • 570
      SSTORE
      _name[14] "" to "tion is a request to move $X fro"
    • 571
      SSTORE
      _name[15] "" to "m A to B, and the state transiti"
    • 572
      SSTORE
      _name[16] "" to "on function reduces the value in"
    • 573
      SSTORE
      _name[17] "" to " A's account by $X and increases"
    • 574
      SSTORE
      _name[18] "" to " the value in B's account by $X."
    • 575
      SSTORE
      _name[19] "" to " If A's account has less than $X"
    • 576
      SSTORE
      _name[20] "" to " in the first place, the state t"
    • 577
      SSTORE
      _name[21] "" to "ransition function returns an er"
    • 578
      SSTORE
      _name[22] "" to "ror. Hence, one can formally def"
    • 579
      SSTORE
      _name[23] "" to "ine: The *state* in Bitcoin is"
    • 580
      SSTORE
      _name[24] "" to " the collection of all coins (te"
    • 581
      SSTORE
      _name[25] "" to "chnically, *unspent transaction "
    • 582
      SSTORE
      _name[26] "" to "outputs* or UTXO) that have been"
    • 583
      SSTORE
      _name[27] "" to " minted and not yet spent, with "
    • 584
      SSTORE
      _name[28] "" to "each UTXO having a denomination "
    • 585
      SSTORE
      _name[29] "" to "and an owner (defined by a 20-by"
    • 586
      SSTORE
      _name[30] "" to "te address which is essentially "
    • 587
      SSTORE
      _name[31] "" to "a cryptographic public keyfn1). "
    • 588
      SSTORE
      _name[32] "" to "A transaction contains one or mo"
    • 589
      SSTORE
      _name[33] "" to "re inputs, with each input conta"
    • 590
      SSTORE
      _name[34] "" to "ining a reference to an existing"
    • 591
      SSTORE
      _name[35] "" to " UTXO and a cryptographic signat"
    • 592
      SSTORE
      _name[36] "" to "ure produced by the private key "
    • 593
      SSTORE
      _name[37] "" to "associated with the owner's addr"
    • 594
      SSTORE
      _name[38] "" to "ess, and one or more outputs, wi"
    • 595
      SSTORE
      _name[39] "" to "th each output containing a new "
    • 596
      SSTORE
      _name[40] "" to "UTXO to be added to the state. T"
    • 597
      SSTORE
      _name[41] "" to "he state transition function APP"
    • 598
      SSTORE
      _name[42] "" to "LY(S,TX) -> S' can be defined ro"
    • 599
      SSTORE
      _name[43] "" to "ughly as follows: For each input"
    • 600
      SSTORE
      _name[44] "" to " in TX: If the referenced UTXO i"
    • 601
      SSTORE
      _name[45] "" to "s not in S, return an error. If "
    • 602
      SSTORE
      _name[46] "" to "the provided signature does not "
    • 603
      SSTORE
      _name[47] "" to "match the owner of the UTXO, ret"
    • 604
      SSTORE
      _name[48] "" to "urn an error. If the sum of the "
    • 605
      SSTORE
      _name[49] "" to "denominations of all input UTXO "
    • 606
      SSTORE
      _name[50] "" to "is less than the sum of the deno"
    • 607
      SSTORE
      _name[51] "" to "minations of all output UTXO, re"
    • 608
      SSTORE
      _name[52] "" to "turn an error. Return S with all"
    • 609
      SSTORE
      _name[53] "" to " input UTXO removed and all outp"
    • 610
      SSTORE
      _name[54] "" to "ut UTXO added The first half of "
    • 611
      SSTORE
      _name[55] "" to "the first step prevents transact"
    • 612
      SSTORE
      _name[56] "" to "ion senders from spending coins "
    • 613
      SSTORE
      _name[57] "" to "that do not exist, the second ha"
    • 614
      SSTORE
      _name[58] "" to "lf of the first step prevents tr"
    • 615
      SSTORE
      _name[59] "" to "ansaction senders from spending "
    • 616
      SSTORE
      _name[60] "" to "other people's coins, and the se"
    • 617
      SSTORE
      _name[61] "" to "cond step enforces conservation "
    • 618
      SSTORE
      _name[62] "" to "of value. In order to use this f"
    • 619
      SSTORE
      _name[63] "" to "or payment, the protocol is as f"
    • 620
      SSTORE
      _name[64] "" to "ollows. Suppose Alice wants to s"
    • 621
      SSTORE
      _name[65] "" to "end 11.7 BTC to Bob. First, Alic"
    • 622
      SSTORE
      _name[66] "" to "e will look for a set of availab"
    • 623
      SSTORE
      _name[67] "" to "le UTXO that she owns that total"
    • 624
      SSTORE
      _name[68] "" to "s up to at least 11.7 BTC. Reali"
    • 625
      SSTORE
      _name[69] "" to "stically, Alice will not be able"
    • 626
      SSTORE
      _name[70] "" to " to get exactly 11.7 BTC; say th"
    • 627
      SSTORE
      _name[71] "" to "at the smallest she can get is 6"
    • 628
      SSTORE
      _name[72] "" to "+4+2=12. She then creates a tran"
    • 629
      SSTORE
      _name[73] "" to "saction with those three inputs "
    • 630
      SSTORE
      _name[74] "" to "and two outputs. The first outpu"
    • 631
      SSTORE
      _name[75] "" to "t will be 11.7 BTC with Bob's ad"
    • 632
      SSTORE
      _name[76] "" to "dress as its owner, and the seco"
    • 633
      SSTORE
      _name[77] "" to "nd output will be the remaining "
    • 634
      SSTORE
      _name[78] "" to "0.3 BTC *change*, with the owner"
    • 635
      SSTORE
      _name[79] "" to " being Alice herself. Minin"
    • 636
      SSTORE
      _name[80] "" to "g If we had access to a trus"
    • 637
      SSTORE
      _name[81] "" to "tworthy centralized service, thi"
    • 638
      SSTORE
      _name[82] "" to "s system would be trivial to imp"
    • 639
      SSTORE
      _name[83] "" to "lement; it could simply be coded"
    • 640
      SSTORE
      _name[84] "" to " exactly as described, using a c"
    • 641
      SSTORE
      _name[85] "" to "entralized server's hard drive t"
    • 642
      SSTORE
      _name[86] "" to "o keep track of the state. Howev"
    • 643
      SSTORE
      _name[87] "" to "er, with Bitcoin we are trying t"
    • 644
      SSTORE
      _name[88] "" to "o build a decentralized currency"
    • 645
      SSTORE
      _name[89] "" to " system, so we will need to comb"
    • 646
      SSTORE
      _name[90] "" to "ine the state transaction system"
    • 647
      SSTORE
      _name[91] "" to " with a consensus system in orde"
    • 648
      SSTORE
      _name[92] "" to "r to ensure that everyone agrees"
    • 649
      SSTORE
      _name[93] "" to " on the order of transactions. B"
    • 650
      SSTORE
      _name[94] "" to "itcoin's decentralized consensus"
    • 651
      SSTORE
      _name[95] "" to " process requires nodes in the n"
    • 652
      SSTORE
      _name[96] "" to "etwork to continuously attempt t"
    • 653
      SSTORE
      _name[97] "" to "o produce packages of transactio"
    • 654
      SSTORE
      _name[98] "" to "ns called *blocks*. The network "
    • 655
      SSTORE
      _name[99] "" to "is intended to produce roughly o"
    • 656
      SSTORE
      _name[100] "" to "ne block every ten minutes, with"
    • 657
      SSTORE
      _name[101] "" to " each block containing a timesta"
    • 658
      SSTORE
      _name[102] "" to "mp, a nonce, a reference to (ie."
    • 659
      SSTORE
      _name[103] "" to " hash of) the previous block and"
    • 660
      SSTORE
      _name[104] "" to " a list of all of the transactio"
    • 661
      SSTORE
      _name[105] "" to "ns that have taken place since t"
    • 662
      SSTORE
      _name[106] "" to "he previous block. Over time, th"
    • 663
      SSTORE
      _name[107] "" to "is creates a persistent, ever-gr"
    • 664
      SSTORE
      _name[108] "" to "owing, *blockchain* that constan"
    • 665
      SSTORE
      _name[109] "" to "tly updates to represent the lat"
    • 666
      SSTORE
      _name[110] "" to "est state of the Bitcoin ledger."
    • 667
      SSTORE
      _name[111] "" to " The algorithm for checking if a"
    • 668
      SSTORE
      _name[112] "" to " block is valid, expressed in th"
    • 669
      SSTORE
      _name[113] "" to "is paradigm, is as follows: Chec"
    • 670
      SSTORE
      _name[114] "" to "k if the previous block referenc"
    • 671
      SSTORE
      _name[115] "" to "ed by the block exists and is va"
    • 672
      SSTORE
      _name[116] "" to "lid. Check that the timestamp of"
    • 673
      SSTORE
      _name[117] "" to " the block is greater than that "
    • 674
      SSTORE
      _name[118] "" to "of the previous blockfn2 and les"
    • 675
      SSTORE
      _name[119] "" to "s than 2 hours into the future C"
    • 676
      SSTORE
      _name[120] "" to "heck that the proof-of-work on t"
    • 677
      SSTORE
      _name[121] "" to "he block is valid. Let S[0] be t"
    • 678
      SSTORE
      _name[122] "" to "he state at the end of the previ"
    • 679
      SSTORE
      _name[123] "" to "ous block. Suppose TX is the blo"
    • 680
      SSTORE
      _name[124] "" to "ck's transaction list with n tra"
    • 681
      SSTORE
      _name[125] "" to "nsactions. For all i in 0...n-1,"
    • 682
      SSTORE
      _name[126] "" to " set S[i+1] = APPLY(S[i],TX[i]) "
    • 683
      SSTORE
      _name[127] "" to "If any application returns an er"
    • 684
      SSTORE
      _name[128] "" to "ror, exit and return false. Retu"
    • 685
      SSTORE
      _name[129] "" to "rn true, and register S[n] as th"
    • 686
      SSTORE
      _name[130] "" to "e state at the end of this block"
    • 687
      SSTORE
      _name[131] "" to ". Essentially, each transaction "
    • 688
      SSTORE
      _name[132] "" to "in the block must provide a vali"
    • 689
      SSTORE
      _name[133] "" to "d state transition from what was"
    • 690
      SSTORE
      _name[134] "" to " the canonical state before the "
    • 691
      SSTORE
      _name[135] "" to "transaction was executed to some"
    • 692
      SSTORE
      _name[136] "" to " new state. Note that the state "
    • 693
      SSTORE
      _name[137] "" to "is not encoded in the block in a"
    • 694
      SSTORE
      _name[138] "" to "ny way; it is purely an abstract"
    • 695
      SSTORE
      _name[139] "" to "ion to be remembered by the vali"
    • 696
      SSTORE
      _name[140] "" to "dating node and can only be (sec"
    • 697
      SSTORE
      _name[141] "" to "urely) computed for any block by"
    • 698
      SSTORE
      _name[142] "" to " starting from the genesis state"
    • 699
      SSTORE
      _name[143] "" to " and sequentially applying every"
    • 700
      SSTORE
      _name[144] "" to " transaction in every block. Add"
    • 701
      SSTORE
      _name[145] "" to "itionally, note that the order i"
    • 702
      SSTORE
      _name[146] "" to "n which the miner includes trans"
    • 703
      SSTORE
      _name[147] "" to "actions into the block matters; "
    • 704
      SSTORE
      _name[148] "" to "if there are two transactions A "
    • 705
      SSTORE
      _name[149] "" to "and B in a block such that B spe"
    • 706
      SSTORE
      _name[150] "" to "nds a UTXO created by A, then th"
    • 707
      SSTORE
      _name[151] "" to "e block will be valid if A comes"
    • 708
      SSTORE
      _name[152] "" to " before B but not otherwise. The"
    • 709
      SSTORE
      _name[153] "" to " one validity condition present "
    • 710
      SSTORE
      _name[154] "" to "in the above list that is not fo"
    • 711
      SSTORE
      _name[155] "" to "und in other systems is the requ"
    • 712
      SSTORE
      _name[156] "" to "irement for *proof-of-work*. The"
    • 713
      SSTORE
      _name[157] "" to " precise condition is that the d"
    • 714
      SSTORE
      _name[158] "" to "ouble-SHA256 hash of every block"
    • 715
      SSTORE
      _name[159] "" to ", treated as a 256-bit number, m"
    • 716
      SSTORE
      _name[160] "" to "ust be less than a dynamically a"
    • 717
      SSTORE
      _name[161] "" to "djusted target, which as of the "
    • 718
      SSTORE
      _name[162] "" to "time of this writing is approxim"
    • 719
      SSTORE
      _name[163] "" to "ately 2187. The purpose of this "
    • 720
      SSTORE
      _name[164] "" to "is to make block creation comput"
    • 721
      SSTORE
      _name[165] "" to "ationally *hard*, thereby preven"
    • 722
      SSTORE
      _name[166] "" to "ting sybil attackers from remaki"
    • 723
      SSTORE
      _name[167] "" to "ng the entire blockchain in thei"
    • 724
      SSTORE
      _name[168] "" to "r favor. Because SHA256 is desig"
    • 725
      SSTORE
      _name[169] "" to "ned to be a completely unpredict"
    • 726
      SSTORE
      _name[170] "" to "able pseudorandom function, the "
    • 727
      SSTORE
      _name[171] "" to "only way to create a valid block"
    • 728
      SSTORE
      _name[172] "" to " is simply trial and error, repe"
    • 729
      SSTORE
      _name[173] "" to "atedly incrementing the nonce an"
    • 730
      SSTORE
      _name[174] "" to "d seeing if the new hash matches"
    • 731
      SSTORE
      _name[175] "" to ". At the current target of ~2187"
    • 732
      SSTORE
      _name[176] "" to ", the network must make an avera"
    • 733
      SSTORE
      _name[177] "" to "ge of ~269 tries before a valid "
    • 734
      SSTORE
      _name[178] "" to "block is found; in general, the "
    • 735
      SSTORE
      _name[179] "" to "target is recalibrated by the ne"
    • 736
      SSTORE
      _name[180] "" to "twork every 2016 blocks so that "
    • 737
      SSTORE
      _name[181] "" to "on average a new block is produc"
    • 738
      SSTORE
      _name[182] "" to "ed by some node in the network e"
    • 739
      SSTORE
      _name[183] "" to "very ten minutes. In order to co"
    • 740
      SSTORE
      _name[184] "" to "mpensate miners for this computa"
    • 741
      SSTORE
      _name[185] "" to "tional work, the miner of every "
    • 742
      SSTORE
      _name[186] "" to "block is entitled to include a t"
    • 743
      SSTORE
      _name[187] "" to "ransaction giving themselves 25 "
    • 744
      SSTORE
      _name[188] "" to "BTC out of nowhere. Additionally"
    • 745
      SSTORE
      _name[189] "" to ", if any transaction has a highe"
    • 746
      SSTORE
      _name[190] "" to "r total denomination in its inpu"
    • 747
      SSTORE
      _name[191] "" to "ts than in its outputs, the diff"
    • 748
      SSTORE
      _name[192] "" to "erence also goes to the miner as"
    • 749
      SSTORE
      _name[193] "" to " a *transaction fee*. Incidental"
    • 750
      SSTORE
      _name[194] "" to "ly, this is also the only mechan"
    • 751
      SSTORE
      _name[195] "" to "ism by which BTC are issued; the"
    • 752
      SSTORE
      _name[196] "" to " genesis state contained no coin"
    • 753
      SSTORE
      _name[197] "" to "s at all. In order to better und"
    • 754
      SSTORE
      _name[198] "" to "erstand the purpose of mining, l"
    • 755
      SSTORE
      _name[199] "" to "et us examine what happens in th"
    • 756
      SSTORE
      _name[200] "" to "e event of a malicious attacker."
    • 757
      SSTORE
      _name[201] "" to " Since Bitcoin's underlying cryp"
    • 758
      SSTORE
      _name[202] "" to "tography is known to be secure, "
    • 759
      SSTORE
      _name[203] "" to "the attacker will target the one"
    • 760
      SSTORE
      _name[204] "" to " part of the Bitcoin system that"
    • 761
      SSTORE
      _name[205] "" to " is not protected by cryptograph"
    • 762
      SSTORE
      _name[206] "" to "y directly: the order of transac"
    • 763
      SSTORE
      _name[207] "" to "tions. The attacker's strategy i"
    • 764
      SSTORE
      _name[208] "" to "s simple: Send 100 BTC to a merc"
    • 765
      SSTORE
      _name[209] "" to "hant in exchange for some produc"
    • 766
      SSTORE
      _name[210] "" to "t (preferably a rapid-delivery d"
    • 767
      SSTORE
      _name[211] "" to "igital good) ait for the deliver"
    • 768
      SSTORE
      _name[212] "" to "y of the product Produce another"
    • 769
      SSTORE
      _name[213] "" to " transaction sending the same 10"
    • 770
      SSTORE
      _name[214] "" to "0 BTC to himself Try to convince"
    • 771
      SSTORE
      _name[215] "" to " the network that his transactio"
    • 772
      SSTORE
      _name[216] "" to "n to himself was the one that ca"
    • 773
      SSTORE
      _name[217] "" to "me first. Once step (1) has take"
    • 774
      SSTORE
      _name[218] "" to "n place, after a few minutes som"
    • 775
      SSTORE
      _name[219] "" to "e miner will include the transac"
    • 776
      SSTORE
      _name[220] "" to "tion in a block, say block numbe"
    • 777
      SSTORE
      _name[221] "" to "r 270000. After about one hour, "
    • 778
      SSTORE
      _name[222] "" to "five more blocks will have been "
    • 779
      SSTORE
      _name[223] "" to "added to the chain after that bl"
    • 780
      SSTORE
      _name[224] "" to "ock, with each of those blocks i"
    • 781
      SSTORE
      _name[225] "" to "ndirectly pointing to the transa"
    • 782
      SSTORE
      _name[226] "" to "ction and thus *confirming* it. "
    • 783
      SSTORE
      _name[227] "" to "At this point, the merchant will"
    • 784
      SSTORE
      _name[228] "" to " accept the payment as finalized"
    • 785
      SSTORE
      _name[229] "" to " and deliver the product; since "
    • 786
      SSTORE
      _name[230] "" to "we are assuming this is a digita"
    • 787
      SSTORE
      _name[231] "" to "l good, delivery is instant. Now"
    • 788
      SSTORE
      _name[232] "" to ", the attacker creates another t"
    • 789
      SSTORE
      _name[233] "" to "ransaction sending the 100 BTC t"
    • 790
      SSTORE
      _name[234] "" to "o himself. If the attacker simpl"
    • 791
      SSTORE
      _name[235] "" to "y releases it into the wild, the"
    • 792
      SSTORE
      _name[236] "" to " transaction will not be process"
    • 793
      SSTORE
      _name[237] "" to "ed; miners will attempt to run A"
    • 794
      SSTORE
      _name[238] "" to "PPLY(S,TX) and notice that TX co"
    • 795
      SSTORE
      _name[239] "" to "nsumes a UTXO which is no longer"
    • 796
      SSTORE
      _name[240] "" to " in the state. So instead, the a"
    • 797
      SSTORE
      _name[241] "" to "ttacker creates a *fork* of the "
    • 798
      SSTORE
      _name[242] "" to "blockchain, starting by mining a"
    • 799
      SSTORE
      _name[243] "" to "nother version of block 270000 p"
    • 800
      SSTORE
      _name[244] "" to "ointing to the same block 269999"
    • 801
      SSTORE
      _name[245] "" to " as a parent but with the new tr"
    • 802
      SSTORE
      _name[246] "" to "ansaction in place of the old on"
    • 803
      SSTORE
      _name[247] "" to "e. Because the block data is dif"
    • 804
      SSTORE
      _name[248] "" to "ferent, this requires redoing th"
    • 805
      SSTORE
      _name[249] "" to "e proof-of-work. Furthermore, th"
    • 806
      SSTORE
      _name[250] "" to "e attacker's new version of bloc"
    • 807
      SSTORE
      _name[251] "" to "k 270000 has a different hash, s"
    • 808
      SSTORE
      _name[252] "" to "o the original blocks 270001 to "
    • 809
      SSTORE
      _name[253] "" to "270005 do not *point* to it; thu"
    • 810
      SSTORE
      _name[254] "" to "s, the original chain and the at"
    • 811
      SSTORE
      _name[255] "" to "tacker's new chain are completel"
    • 812
      SSTORE
      _name[256] "" to "y separate. The rule is that in "
    • 813
      SSTORE
      _name[257] "" to "a fork the longest blockchain is"
    • 814
      SSTORE
      _name[258] "" to " taken to be the truth, and so l"
    • 815
      SSTORE
      _name[259] "" to "egitimate miners will work on th"
    • 816
      SSTORE
      _name[260] "" to "e 270005 chain while the attacke"
    • 817
      SSTORE
      _name[261] "" to "r alone is working on the 270000"
    • 818
      SSTORE
      _name[262] "" to " chain. In order for the attacke"
    • 819
      SSTORE
      _name[263] "" to "r to make his blockchain the lon"
    • 820
      SSTORE
      _name[264] "" to "gest, he would need to have more"
    • 821
      SSTORE
      _name[265] "" to " computational power than the re"
    • 822
      SSTORE
      _name[266] "" to "st of the network combined in or"
    • 823
      SSTORE
      _name[267] "" to "der to catch up (hence, *51% att"
    • 824
      SSTORE
      _name[268] "" to "ack*)."
    • 825
      SSTORE
      _name[length] 0 to 6
    • 826
      SLOAD
    • 827
      SSTORE
      (_symbol[data], _symbol[length]) ("" to "GENESIS", 0 to 7)
    • 828
    • 829
    • 831
      SSTORE
      maxTransaction 0 to 360000000000000000000000
    • 832
      SSTORE
      maxWalletHolding 0 to 360000000000000000000000
    • 833
      SSTORE
      contractSellTreshold 0 to 72000000000000000000000
    • 834
      SSTORE
      devBuyTax 0 to 1
    • 835
      SSTORE
    • 836
      SLOAD
    • 837
      SLOAD
    • 838
      SSTORE
      totalBuyTax 0 to 1
    • 839
      SSTORE
      devSellTax 0 to 1
    • 840
      SSTORE
    • 841
      SLOAD
    • 842
      SLOAD
    • 843
      SSTORE
      totalSellTax 0 to 1
    • 844
    • 845
    • 846
    • 847
    • 848
      SHA3
      0x0000000000000000000000006dc0868d33f556e77252280696158defb3d648110000000000000000000000000000000000000000000000000000000000000019
       
      0x24b95acd8d68ccb989faa07aa5e9c5464d8a49cc331d405963d275f4513d7a4c
    • 849
    • 850
    • 851
      LOG
      ExcludeFromFees (account= 0x6dc0868d33f556e77252280696158defb3d64811, isExcluded=true)
    • 852
    • 853
      SHA3
      0x000000000000000000000000a291acaf4a8fe16a5b1f15c6d6004fa3ab7f58ca0000000000000000000000000000000000000000000000000000000000000019
       
      0x4b57e9c0eb7a4aa7e446b9ab56f42c20814ee337f810ca27c3906ac904057f4c
    • 854
    • 855
    • 856
      LOG
      ExcludeFromFees (account= GENESIS, isExcluded=true)
    • 857
    • 858
      SHA3
      0x000000000000000000000000000000000000000000000000000000000000dead0000000000000000000000000000000000000000000000000000000000000019
       
      0xc73b1d6eda13a615b81c31830292dbbbf5fbb07f472982e223002bd83d5c3dc4
    • 859
    • 860
    • 861
      LOG
      ExcludeFromFees (account= 0x000000000000000000000000000000000000dead, isExcluded=true)
    • 862
    • 863
    • 864
      SHA3
      0x0000000000000000000000006dc0868d33f556e77252280696158defb3d648110000000000000000000000000000000000000000000000000000000000000019
       
      0x24b95acd8d68ccb989faa07aa5e9c5464d8a49cc331d405963d275f4513d7a4c
    • 865
    • 866
    • 867
      LOG
      ExcludeFromFees (account= 0x6dc0868d33f556e77252280696158defb3d64811, isExcluded=true)
    • 868
    • 869
    • 870
      SHA3
      0x0000000000000000000000006dc0868d33f556e77252280696158defb3d64811000000000000000000000000000000000000000000000000000000000000001a
       
      0x541aa79f898591504aa4a80120a2253f8a18db25462c5e5b445484b05a744eb9
    • 871
    • 872
    • 873
    • 874
      SHA3
      0x000000000000000000000000a291acaf4a8fe16a5b1f15c6d6004fa3ab7f58ca000000000000000000000000000000000000000000000000000000000000001a
       
      0xd3837daf64a2834650bf553e1c5241294b4f212fc256abd734959d542de7a45a
    • 875
    • 876
    • 877
    • 878
      SHA3
      0x000000000000000000000000000000000000000000000000000000000000dead000000000000000000000000000000000000000000000000000000000000001a
       
      0x428bdc965569ef4717764ecfd84e88946a9a226b52b813e6ab6a7f46aad86e88
    • 879
    • 880
    • 881
    • 882
    • 883
      SHA3
      0x0000000000000000000000006dc0868d33f556e77252280696158defb3d64811000000000000000000000000000000000000000000000000000000000000001a
       
      0x541aa79f898591504aa4a80120a2253f8a18db25462c5e5b445484b05a744eb9
    • 884
    • 885
    • 886
      SLOAD
    • 887
      SSTORE
      _totalSupply 0 to 72000000000000000000000000
    • 888
      SHA3
      0x0000000000000000000000006dc0868d33f556e77252280696158defb3d648110000000000000000000000000000000000000000000000000000000000000000
       
      0xc7afe6154b4ebb298da9b40a16b233317597d3df4a6fbe462aabb52068a24998
    • 889
    • 890
      SHA3
      0x0000000000000000000000006dc0868d33f556e77252280696158defb3d648110000000000000000000000000000000000000000000000000000000000000000
       
      0xc7afe6154b4ebb298da9b40a16b233317597d3df4a6fbe462aabb52068a24998
    • 891
      SSTORE
    • 892
      LOG
      Transfer (from= 0x0000000000000000000000000000000000000000, to= 0x6dc0868d33f556e77252280696158defb3d64811, value=72000000000000000000000000)