Presentation is loading. Please wait.

Presentation is loading. Please wait.

Campbell R. Harvey Duke University and NBER

Similar presentations


Presentation on theme: "Campbell R. Harvey Duke University and NBER"— Presentation transcript:

1 Campbell R. Harvey Duke University and NBER
January 19, 2018 Mining Simulation Campbell R. Harvey Duke University and NBER Campbell R. Harvey 2018

2 Open browser tabs New Google doc: http://tinyurl.com/h8nzqj8
Open Coinbase app on your smart phone and set it on “My address” (hit the QR icon in top right beside the airplane, choose “My address” which is beside “Scan code) Campbell R. Harvey 2018

3 The Plan Dummy transactions will be hashed to constitute a Merkle tree root The root will be copied into the common (read only) Google doc You copy all the information from the doc into the hashing program and vary the nonce The maximum nonce size is 232 which is approximately 109 Everyone should start at a different number (say ) and then increment by one number at a time, , , just changing the last number Once you have a leading zero, raise your hand and shout “got it” Campbell R. Harvey 2018

4 The Plan I will copy your nonce and winning hash into the Google doc
I will verify the solution If verified, come to the front of the class with your address available I pay the winner 0.01BTC I then start a new block with The winning hash New Merkle root New time Repeat. If blocks are mined too quickly, we will adjust the difficulty Campbell R. Harvey 2018

5 The Mechanics 80 bytes 4 bytes: version number (same for all miners)
32 bytes: previous block (same for all miners) 32 bytes: hash of the transactions in the candidate block 4 bytes: time stamp (in seconds since T00:00 UTC) 4 bytes: difficulty of task (same for all miners) 4 bytes: nonce Campbell R. Harvey 2018

6 The Mechanics Simplified version in Google doc http://tinyurl.com
Campbell R. Harvey 2018

7 The Mechanics Hash of the transactions is a Merkle tree (or hash tree) which includes multiple hashes Merkle root Campbell R. Harvey 2018 HA represents a hash of transaction A

8 The Mechanics Let’s start with four simplified transactions, and hash each one Marcela pays Camille 1BTC Aaron pays Lee 0.5BTC Rashid pays Soo 0.75BTC Kristen pays Austin 5BTC Campbell R. Harvey 2018

9 The Mechanics Let’s start with four simplified transactions, and hash each one Marcela pays Camille 1BTC f2bde94f fafd424d ed deec99d85be394214c9bf30 Aaron pays Lee 0.5BTC 4b7f76675d1a597d4e72112b2b547af233c cdd80a76ccb4ace23f Rashid pays Soo 0.75BTC 63c a1cce7882b15ffc52f828cff9ff957e71f61e Kristen pays Austin 5BTC 470a8a8aca43f256f603f86ac46947b34a e90c32dc9b91aa1ccee528 Campbell R. Harvey 2018

10 The Mechanics Hash the two red transactions and the two green transactions 2 Pinks result in 01c3098ca5081a5c63bc62c bb7675a cfa44d4f08dde3d8 2 Blues result in 716916c89f172e3cb340bf244f9917a70c504ae78ffcc0ef542acef5c260fb2e Campbell R. Harvey 2018

11 The Mechanics Hash the last two hashes Merkle root
b236b a1f5dddf37af f055cd9a bfeb3c095be5da Campbell R. Harvey 2018

12 The Mechanics 80 bytes: Version: (fixed)
3 Previous block hash: (fixed) f5de334085b92ce27c03888c726c9b2bb78069e55aeb6 Merkle root: (variable) b236b a1f5dddf37af f055cd9a bfeb3c095be5da Time: (variable) Difficulty: (fixed) Nonce: (variable) ? Campbell R. Harvey 2018

13 The Mechanics Blockheader (simplified)
f5de334085b92ce27c03888c726c9b2bb78069e55aeb6b236b a1f5dddf37af f055cd9a bfeb3c095be5da I added a nonce. I will give you access to a read only Google doc You will copy this into You will then vary the hash. Campbell R. Harvey 2018

14 The Mechanics Blockheader simplification: All fields are in hex
All fields are little endian There is a double hash done – not a single hash The final hash is little endian Note: Miners hashing 80 bytes = 160 hexadecimal = 640 bits Campbell R. Harvey 2018

15 The Mechanics Other Merkle roots to be used in simulation
f8e7aca1004d73a4301fe83e04eb a d1d763a52c400d9cab 2b83643feafa3e7fa56402b494cb03f11a5057d42c2bbe92e0a3356f89b652f8 cf36545c255be251f22b25a2511c88626d154ba76ac653ea8c80ff4b8d9996e1 c1a35c8516e2ac146e3d15c83ab557b8374e1627b3e5d432a9dee9bd634b4788 9ba5678e7b4cc513f5055c26b63f53a085eabd447dfb13bed05fab4f79067d90 fe26bb f9ab366fc2f d11efda77946b7ebc14682 ba4385a7b0c34656a6628f83572c763d4cae38ce63c9dd89e46a7085aea10e02 ed6c5395ad e4e3411aa cea108134b2f0fb864327efc5 f6ff2e2618a68b4c76908dd97a054c403647f4f20eba4c233476c1378e9ff6d4 Campbell R. Harvey 2018


Download ppt "Campbell R. Harvey Duke University and NBER"

Similar presentations


Ads by Google