0% found this document useful (0 votes)
19 views53 pages

Lecture.1

The document introduces blockchain technologies, focusing on Bitcoin as a decentralized virtual currency system that operates without a central authority. It outlines the course structure, covering cryptography, algorithms, and blockchain fundamentals, while clarifying that it does not delve into economics or trading. Additionally, it provides a historical timeline of Bitcoin's development and key milestones, emphasizing its significance as a distributed ledger technology.

Uploaded by

李世哲
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views53 pages

Lecture.1

The document introduces blockchain technologies, focusing on Bitcoin as a decentralized virtual currency system that operates without a central authority. It outlines the course structure, covering cryptography, algorithms, and blockchain fundamentals, while clarifying that it does not delve into economics or trading. Additionally, it provides a historical timeline of Bitcoin's development and key milestones, emphasizing its significance as a distributed ledger technology.

Uploaded by

李世哲
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

INTRODUCTION TO

BLOCKCHAIN TECHNOLOGIES
Prolegomena
Σωκράτης:
λέγει που Ἡράκλειτος ὅτι ‘πάντα χωρεῖ καὶ οὐδὲν μένει,’ καὶ ποταμοῦ ῥοῇ
ἀπεικάζων τὰ ὄντα λέγει ὡς ‘δὶς ἐς τὸναὐτὸν ποταμὸν οὐκ ἂν ἐμβαίης.’
Ἑρμογένης:
ἔστι ταῦτα.
—Plato, Cratylus, 402a
• “A distributed system is one in which the failure of a computer you didn't even know existed can
render your own computer unusable.”—Leslie Lamport (cf. Byzantine General’s Problem)
• “In terms of cryptocurrencies, generally, I can say with almost certainty that they will come to a bad
ending”—Warren Buffet
• “Scares the hell out of me...”—Conversation with an anonymous bank director, Ritz Bar, 2017
• “Bitcoin is evil.”—Paul Krugman, New York Times editorial, December 28, 2013
About this course
• What are we going to do?
• Foundations:
• Cryptography (Introduction, Hash Functions and Pointers)
• Algorithms (SHA256, RIPEMD-160, Base58Check, Elliptical Curves, Balanced Binary Trees, Merkle Trees)
• Graph Theory
• Game Theory
• Blockchain predecessors, history and fundamentals
• Bitcoin Transactions and Cryptocurrencies, with a focus on bitcoin-core
and supporting APIs
• Other stuff if we have time
• What are you going to do?
• Some labs exercising the above stuff in a language of your choice***
• Write and mine your own simplified distributed peer-to-peer blockchain with
supporting algorithms (SHA-256, Base58Check, Merkle Chains, etc.)
• Work on a team with classmates and build a blockchain solution of your
choice
What this course is not...
• This is not a course in economics, although we will talk a little about money and value
• This is not a course in finance, although we will talk a little about banking as well
• This is not a course in trading cryptocurrencies, or arbitraging cryptocurrencies across
exchanges
• This is not a course on the legal ramifications of cryptocurrency, although we will
mention a few uncertainties
• What we will do is focus on blockchain architecture by using Bitcoin as a reference
model
• Syllabus Review
Circles: Bitcoin is Hard
• There’s lots to talk about...
• We’re going to talk about all of these
concepts and more
• Bitcoin is like an onion...hard to talk
about one thing without presupposing
knowledge of another thing
• We’ll peel the onion strategically,
introducing concepts early and then
diving in to details later, when we peel
another layer of the onion
• And sometimes you may cry when
peeling the bitcoin onion...
What is Bitcoin? A Starter Definition...
• Bitcoin is “a virtual currency system that eschewed a central authority for issuing
currency, transferring ownership, and confirming transactions.”—Marco Iansiti and
Karim R. Lakhani, “The Truth About Blockchain,” Harvard Business Review, Jan-Feb,
2017
• How’s that for starters?
A Starter Definition...
• Bitcoin is “a virtual currency system that eschewed a central authority for issuing
currency, transferring ownership, and confirming transactions.”—Marco Iansiti and
Karim R. Lakhani, “The Truth About Blockchain,” Harvard Business Review, Jan-Feb,
2017
• That’s like defining an Automobile as:
• An automobile is “a physical gasoline-fueled propulsion system that eschewed sitting
idle but rather leverages a human being for initiation and direction-handling.”
A Starter Definition...
• Which is better:
• Bitcoin is “a virtual currency system that eschewed a central authority for issuing currency, transferring
ownership, and confirming transactions.”—Marco Iansiti and Karim R. Lakhani, “The Truth About
Blockchain,” Harvard Business Review, Jan-Feb, 2017
• Or:
• “Satoshi Nakamoto’s ingenious solution lay in a mix of carrot-and-stick incentives that encouraged
those who were validating transactions to do so honestly...If we view the bitcoin currency from this
angle—and not merely as it is popularly portrayed, as a strange new digital unit of value that some geeky
guys think is a good alternative to dollars, euros, or yen—we can build a conceptual framework for
understanding the wider implications of Satoshi’s invention. The currency, bitcoin (lowercase ‘b’) is
first and foremost a store of value that rewards people for securing Bitcoin (uppercase ‘B’), the system
[sc. Blockchain]. That, and not the hope that it will become an everyday medium of exchange, is its
primary purpose. Without its existence as an incentive for computer owners to honestly validate
exchanges of valuable information, Satoshi’s censorship-resistant distributed ledger simply wouldn’t
work.”—Casey and Vigna, The Truth Machine, 2018
Bitcoin and Blockchain at 35,000 feet
• Blockchain is a Distributed Ledger Technology that incorporates a network of mostly
redundant public data stores that interoperate securely, without being controlled and
administered by a central authority, that is known and trusted by all participants, through
the provisioning of incentives to ensure that trust.
• Bitcoin, at the highest level, consists of:
• A decentralized peer-to-peer network (aka the
Bitcoin Protocol)
• A public transaction ledger (the Blockchain)
• A set of rules for independent transaction validation
(Consensus rules)
• A set of rules for money supply (Mining)
• A mechanism for reaching global decentralized
consensus on the Blockchain (Proof-of-Work)
BITCOIN AT 30,000 FEET
“Bitcoin...it’s best understood as a Truth Machine”—Casey and Vigna, The Truth Machine
Bitcoin’s Peer-to-Peer Communication – High-Level View
• Nodes are connected to a small set of “neighboring” peers
• If Alice wants to send a message to Bob, she starts by sending it to those nodes she
knows about, Carmen and Dave
• Carmen and Dave then forward the message to their immediate peers, and so on until
the message reaches Bob
Bitcoin and Blockchain at 20,000 feet
• Bitcoin, at the highest level, has the following characteristics:
• Two parties can transact directly without the need for a “trusted” third party intermediary
• Transactions cannot be reversed, you can’t step into the same river twice
• Double-spending is extraordinarily unlikely (and has empirically proven to be so)
• Anyone can join the Bitcoin network
• Users create wallets to interact with the Bitcoin network
• A wallet has unique addresses (bitcoin addresses) that identify it in the network
• The address comes with a pair of cryptographic keys for signing and verifying transactions,
which are sent and received with reference to wallet addresses
• Each (full) node keeps a full history of all transactions (the blockchain), currently ∼613 Gig
• Although transactions in the ledger are not encrypted, user pseudo-anonymity is preserved
because only the wallet bitcoin addresses of users are publicly exposed
• Mining nodes verify transactions and each work on solving a “mathematically difficult puzzle”
• The winning puzzle-solving miner is rewarded with bitcoins and adds the winning block with
its transactions to the blockchain and is validated and replicated by nodes
Bitcoin Timeline: The $338 Million Dollar Pizza
January 3, 2009
Satoshi
November 9, Nakamoto mines
2008, the Genesis Block, October 12, 2009
Bitcoin project is November 29,
the first 50 New Liberty sells
registered on 2013 December 17, 2017
bitcoins 5,050 BTC for July 18, 2010
BTC surpasses BTC reaches current
SourceForge $5.02 BTC surpasses $1,000 for first
$.01 (one penny) all-time high of
time, propelled by By 2018 there are
for first time $19,783
Chinese investors
over 5,000 ATMS for
January 12, 2009
bitcoin world-wide
August 15, 2008 First Transaction,
February 6, 2010 February 9, 2011 April 1, 2012 Further price volatility,
King et. al. sale, Block 170
The Bitcoin Market BTC surpasses $1 BTC surpasses
Encryption patent SatoshióHal
$100 for first time,
1BTC = $1,000-$5,000
filed Finney currency exchange for first time
established Silk Road opens then to $200 less
than a week later

2018-
2008 2009 2010 2011 2012 2013 2014 2015 2016 2017
2025

December 16, February, 2013


August 18, 2008
2009 Mt. Gox exchange
bitcoin.org
Version 0.2 November 11, 2010 suspended trading,
registered
released, Bitcoin rises 200% in April 11, 2013 closed its website and
Version 0.3 on 5 days to $.36 Mt. Gox exchange exchange service, and
July 7 2010 sees BTC go from filed for bankruptcy
June 19, 2011 $200 to $67 in panic
November 28, 2017 December 5, 2024
Mt. Gox exchange sell-off
October 31, 2008 October 5, 2009 Between 2011 and 2013 BTC passes BTC breaks $100K
May 22, 2010 raided, 1 BTC
Satoshi First $-B exchange Ross Ulbricht (aka “The $10,000
Laszlo Hanyecz orders plummets to a
Nakamoto rate: Dread Pirate Roberts”),
two pizzas for 10,000 penney used Bitcoin for illegal
publishes Bitcoin $1 = 1,309.03BTC BTC ($41.00 including
1BTC = $0.00076 delivery). That’s transactions in drugs and
White Paper
$676MM in todays arms on the Silk Road
dollars (6/2024). Website

January 9, 2009 July 9, 2011


Version 0.1.0 of Gawker exposes
code released darknet Silk Road
(Visual Studio) drives BTC to
$31.00
Satoshi Nakamoto’s Original Bitcoin Source Code
• Released on January 9, 2009
• Version 0.01 (“ALPHA”) of Bitcoin (Satoshi Nakamoto’s original release) had around
14,500 lines of Visual C++ source code
• 10 C++ source files:
db.cpp irc.cpp main.cpp market.cpp net.cpp script.cpp sha.cpp ui.cpp uibase.cpp util.cpp
• 16 C++ header files
• 8,623 lines of C++ source code (Microsoft Visual Studio/C++)
• 5,924 lines of code in C++ header files
• Almost a year later, Version 0.02 was released on December 16, 2009, with fixes and the
first Linux release as well
Big Year in Bitcoin: 2010 July 17,
Jed McCaleb releases the
Mt. Gox Bitcoin currency
exchange, sells it in March
September 29, another
exploit discovered, a
microtransactions exploit is
discovered by kermit,
2011 to MagicalTux, Mark December 9, the first
precipitating the release of
Karpelès call option sold and
Around May 2010 Version 0.3.13.
bitcoin ends the year
Laszlo Hanyecz
just under $0.30
begins to mine bitcoin
February 6, using Graphical July 18,
The Bitcoin Market Processing Units, BTC surpasses
currency exchange GPUs $.01 (one penny) October 17, #bitcoin-
established July 7, for first time otc trading opens,
October 1,
Version 0.03 of October 28 first
OpenCL miner is
code released short sale of bitcoin
Miners are able to mine Miners are able to mine released
10,000’s of coins a month fewer and fewer coins/month
Laszlo’s
“Edge”

JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC

September 18, 2010,


May 22, Mid year, Wikipedia flags December 9, mining
July 13-18, 2010 2010, the first mining
Laszlo Hanyecz orders the bitcoin article for difficulty exceeds
price jumps by a pool, Slush's Pool,
two pizzas for 10,000 deletion because it’s mines its first block 10,000
factor of 10, from
BTC (∼$41.00), jercos of becoming irrelevant... $0.008 to 8¢
In March 2010 London orders delivery
SmokeTooMuch from a Jacksonville, FL October 16, November 6-11, 2010
offered to auction Papa John’s Pizza 2010, first market capitalization
10,000 BTC...there August 15, A vulnerability in the escrow exceeds $1MM,
were no takers. 1 Bitcoin system that causes transaction Bitcoin rises 200% in
BTC ∼ 1/5 of a penny Bitcoins to be improperly verified 5 days to $0.36
is exploited, resulting in the
generation of 184 billion bitcoins in
block 74638. The block chain had On October 22, 2010, The
to be forked. The "good" block Financial Action Task Force,
chain overtook it at a block height an inter-governmental
watchdog group, issues
of 74691. The bad transaction no
warning about the use of digital
longer exists. currencies to finance terrorist
groups
The $980,000,000 Pizzas
Bitcoin: The First Ten Days
• On October 31, 2008, a newcomer by the name of Satoshi Nakamoto
(satoshin@gmx.com) submitted a paper on a cryptography mailing list at metzdowd.com
• Before October 31, 2008, no one had ever heard of Satoshi Nakamoto
• The Genesis Block was “mined” on January 3, 2009, by Satoshi Nakamoto
• On January 9, 2009, “he” released version 0.1.0 of the bitcoin source code on
sourceforge.com
• On January 10, 2009, Hal Finney, who worked with Phil Zimmerman at PGP
Corporation and who was himself most known for developing a reusable proof-of-work
system, downloaded the software and started running it
• When Finney tried to run the software, it crashed, and Finney wrote Satoshi letting him
know there’s a bug
• The email exchanges between the two are all business...no personal information is
shared
Bitcoin: The First Ten Days
• Satoshi isolated the bug and released version 0.1.2 and Finney tried to run that, it
crashed, then more fixes and then version 0.1.3 crashed, and on and on it went for
several days of testing
• During this time Satoshi comments to Finney that there appeared to be several zombie
nodes that were running and neither of them were Satoshi or Finney
• Finney kept mining for the next several days until he’d mined about 1,000 bitcoins.
• In those first six days alone, at the rate of the mining algorithm, Satoshi Nakamoto and
Hal Finney would have mined over 43,200 coins (24 hours * (6 10-minute
periods/hour) * 50 coins/reward * 6 days) (worth about $4.2 billion in today’s dollars)
• Finney said he stopped mining when he became concerned his fan on his computer
might burn out from puzzle solving
• Nakamoto is estimated to have accumulated over 1 million bitcoins (estimated to have
mined ~ 22,000 blocks @ a block reward of 50 coins)
• The first transaction was conducted on January 12, 2009, nine days after the release of
0.1, between Satoshi and Finney
Bitcoin: The First Ten Days
• Others became involved, including Nick Szabo and Wei Dai, and eventually Gavin
Andresen, and others
• A community of early developers organized and began contributing fixes and updates to
the emerging software system
• On December 16, 2009, Bitcoin 0.2 was released, which included a Linux version for
the first time and made use of multi-core processors for mining.
• New releases and bug fixes were delivered regularly over the years until on December 12,
2010, Satoshi Nakamoto sent his last post to the developer’s list, referencing “more work
to do on DoS” and release 0.3.19. That would prove to be the last post of Satoshi
Nakamoto, but not the last word
• Then on April 23, 2011, like the Lone Ranger, Satoshi Nakamoto sent an email to his
group of core developers that said simply, “I’ve moved on to other things. It’s in good
hands with Gavin and everyone.”
• And then Satoshi Nakamoto disappeared as mysteriously as he appeared
Bitcoin Stats (as of June 1, 2024)
• The bitcoin network consists of over 19,423 publicly accessible full nodes (≈ 25% in
US)
• A single bitcoin is currently worth ≈ $94,384.77 (as of January 1, 2025)
• The all-time high was $108,357.60 on December 17, 2024
• All the bitcoins in the world are worth roughly US$1.3 Trillion
• Bitcoin's money supply is in excess of 19,800,000 BTC (blockchain.com)
• Bitcoin’s current market capitalization is ≈ US$1.88 Trillion
• The combined value of bitcoin is equivalent to roughly 0.3% of the world's money
supply, and is equivalent to roughly 7-8% of the world’s gold supply
• The average block size is about 1.5 megabytes (lately...)
Bitcoin Stats (as of June 1, 2024)
• The bitcoin network processes about 600,000 transactions per day (lately...)
• Each block has an average of ≈ 3,800 transactions (averaged over the past 12 months)
(but has ranged as high as ≈ 5,500 transactions/block)
• Total network mining hashrate has ranged from about 470 to 817 EH/s this year
(ExaHashes (quintillion hashes) the Bitcoin network is performing per second)
• 817,000,000,000,000,000,000 = 817.0 x 1018 hashes each and every second
• A winning block is currently rewarded with 3.125 BTC (∼ US$306,250 per block as of
1/1/2025)
• Transaction fees average about $3.50 per transaction recently (although they vascillate
greatly (80x) over any given 12-month span)
• Over the past 12 months, miners as a whole have earned (very roughly) about US$15
billion in block rewards and transaction fees
BITCOIN CORE
The Standard Bitcoin Software

Bitcoin is “an incentives-weighted concept of security. It is security by design, not by patch.”


—Casey and Vigna, The Truth Machine
Bitcoin Core
• Bitcoin Core includes a transaction verification engine and connects to the bitcoin
network as a full node (additional parameters are needed for a full node)
• Bitcoin Core is the direct descendant of the original Bitcoin software client released by
Satoshi Nakamoto in the fall of 2008.
• Bitcoin Core consists of “full-node” software for fully validating the blockchain
• Bitcoin Core also includes an internal cryptocurrency bitcoin wallet, which can be used
to transfer funds.
• The internal wallet allows for the sending and receiving of bitcoins but not the buying
or selling of bitcoin.
• The wallet allows users to generate QR codes to receive payment.
Bitcoin Core
• The Bitcoin Core software validates the entire blockchain, which includes all bitcoin
transactions ever.
• This distributed ledger (blocks on disk) which has reached about 667 gigabytes in size (as
of 1/1/2025) and must be downloaded or synchronized before full participation of the
client may occur.
• We do not need the complete blockchain all at once, as it is possible to run in pruned
mode, which can greatly reduce size (roughly 5% of a a full node).
• A command line-based daemon with a JSON-RPC interface called bitcoind, is provided
by Bitcoin Core.
• bitcoin-cli, a simple program which allows users to send RPC commands to bitcoind, is
also included.
• Bitcoin Core includes a stack-based scripting language (inspired by Forth) that facilitates
transactions (execution and validation) and parameter specification.
The Bitcoin Core Architecture

Full Node

Bitcoin-cli &
others…
The Bitcoin
Peer-2-Peer
Network
Bitcoin Environments
• Bitcoin may be run in a variety of incarnations:
• Mainnet: The real Bitcoin blockchain, launched by Satoshi Nakamoto, the one on which you can
become a millionaire or lose all your private keys...
• Testnet: A full-featured live peer-to-peer network, replete with wallets, bitcoins, and other users
(testers), with one exception, you’re playing with monopoly money
• You get free play money from faucets...
• Mining difficulty is low (so you can play around)
• Despite pleas from developers, some morons insist on launching ASICs at
Testnet, so every once in a while it needs to be scrapped and restarted, TESTNET
we are currently on Testnet3 (but things are looking good...)
• Allows testing of segregated witness
• Regtest: Your own personal bitcoin blockchain
• “In the Raw”
• Starts in a virgin state
• Yours to play with as you wish
Testnet
• The default Bitcoin network protocol listening port is 18333 (instead of 8333 on main)
• The default RPC connection port is 18332 (instead of 8332 on main)
• Bootstrapping uses different DNS seeds
• A different value of the ADDRESSVERSION field ensures no Testnet Bitcoin addresses
will work on the production network. (0x6F rather than 0x00 for Mainnet)
• The protocol message header bytes are 0x0B110907 (instead of 0xF9BEB4D9 on main)
• Testnet mining difficulty is much less than on Mainnet.
• If no block has been found in 20 minutes, the difficulty automatically resets back to the
minimum for a single block, after which it increases.
• A new genesis block 0
• The IsStandard() check is disabled so that non-standard transactions can be
experimented with.
• Testnet receives fewer transactions than the main block chain and is typically much
smaller in size. As of January 1, 2025, the size of the data on disk is about 192 Gigs,
containing data for about 13 years of Testnet (version 3) activity.
Bitcoin SDLC

Regtest Testnet Mainnet

Design and Build Test and Run Deploy and Duck


2018-06-13 16:49:09 Bitcoin Core version v0.16.0 (release build)
...
2018-06-13 16:49:09 WalletParameterInteraction: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0
2018-06-13 16:49:09 Using the 'sse4' SHA256 implementation
2018-06-13 16:49:09 Using RdRand as an additional entropy source
2018-06-13 16:49:09 Default data directory /Users/mark/Library/Application Support/Bitcoin
2018-06-13 16:49:09 Using data directory /Users/mark/Library/Application Support/Bitcoin/testnet3
2018-06-13 16:49:09 Using config file /Users/mark/Library/Application Support/Bitcoin/bitcoin.conf
2018-06-13 16:49:09 Using at most 16 automatic connections (256 file descriptors available)
...

What You’re 2018-06-13 16:49:09 Binding RPC on address 0.0.0.0 port 18332 failed.
2018-06-13 16:49:09 HTTP: creating work queue of depth 16
...

Looking To 2018-06-13 16:49:09 HTTP: starting 4 worker threads


2018-06-13 16:49:09 Using wallet directory /Users/mark/Library/Application Support/Bitcoin/testnet3/wallets
...

See... 2018-06-13 16:49:09 Using wallet wallet.dat


2018-06-13 16:49:09 CDBEnv::Open: LogDir=/Users/mark/Library/Application Support/Bitcoin/testnet3/wallets/database
ErrorFile=/Users/mark/Library/Application Support/Bitcoin/testnet3/wallets/db.log
2018-06-13 16:49:09 Cache configuration:
2018-06-13 16:49:09 * Using 192.0MiB for block index database
2018-06-13 16:49:09 * Using 8.0MiB for chain state database
2018-06-13 16:49:09 * Using 1336.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-06-13 16:49:09 init message: Loading block index...
...
Bunch of messages about loading the blockchain data files and indices
...
2018-06-13 16:49:20 Loaded best chain: hashBestChain=00000000000045047c9e961870c2504259201beb86b513dded7059f394e11c46 height=1325334
date=2018-06-13 14:29:53 progress=0.999959
2018-06-13 16:49:20 init message: Rewinding blocks...
2018-06-13 16:49:25 init message: Verifying blocks...
2018-06-13 16:49:25 Verifying last 6 blocks at level 3
2018-06-13 16:49:25 [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
BITCOIN CORE LIBRARIES
Language-based Bitcoin Libraries & Toolkits
• C/C++
• Bitcoin Core: The reference implementation of bitcoin (https://github.com/bitcoin/bitcoin)
• libbitcoin: Cross-platform C++ development toolkit (https://github.com/libbitcoin/libbitcoin)
• Bitcoin Explorer: Libbitcoin’s command-line tool (https://github.com/libbitcoin/libbitcoin-explorer)
• picocoin: A C language lightweight client library for bitcoin (https://github.com/jgarzik/picocoin)
• JavaScript
• Bcoin: A full-node implementation with API (http://bcoin.io)
• Bitcore: Full node, API, and library by Bitpay (https://bitcore.io)
• BitcoinJS: A pure JavaScript Bitcoin library for node.js (https://github.com/bitcoinjs/bitcoinjs-lib)
• Java
• Bitcoinj: A Java full-node client library (https://bitcoinj.github.io)
Language-based Bitcoin Libraries & Toolkits
• PHP
• bitwasp/bitcoin: A PHP bitcoin library, and related projects (https://github.com/bit-wasp/bitcoin-php)
• Python
• python-bitcoinlib: Peter Todd’s bitcoin library, consensus library (https://github.com/petertodd/python-bitcoinlib)
• Pycoin: A Python bitcoin library by Richard Kiss (https://github.com/richardkiss/pycoin)
• Pybitcointools: A Python bitcoin library by Vitalik Buterin (https://github.com/vbuterin/pybitcointools)
• Ruby
• bitcoin-client: A Ruby library wrapper for the JSON-RPC API (https://github.com/sinisterchipmunk/bitcoin-
client)
• Go
• btcd: A Go language full-node bitcoin client (https://github.com/btcsuite/btcd)
• C#
• Nbitcoin: A Comprehensive bitcoin library for the .NET framework (https://github.com/MetacoSA/NBitcoin)
• Objective-C
• CoreBitcoin: Bitcoin toolkit for ObjC and Swift (https://github.com/oleganza/CoreBitcoin)
Online Resources
• Blockchain Information (Bitcoin): https://blockchain.info
• Coindesk Blockchain 101: https://www.coindesk.com/information/
• Bitcoin Wiki: https://en.bitcoin.it/wiki/Main_Page
• Bitcoin FAQ: https://en.bitcoin.it/wiki/Help:FAQ
• Bitcoin Developer’s Reference: https://bitcoin.org/en/developer-reference
• Bitcoin Protocol Specification: https://en.bitcoin.it/wiki/Protocol_documentation
• Bitcoin trading statistics: https://data.bitcoinity.org/markets/volume/30d?c=e&t=b
• Market (Technical) Analysis: https://www.tradingview.com/symbols/BTCUSD/technicals/
• Mining Profitability: https://www.cryptocompare.com/mining/calculator/btc
Obtaining Current Bitcoin Source Code
• mkdir bitcoin.source.code
• git clone https://github.com/bitcoin/bitcoin.git
• git tag [see a bunch of versions]
• git checkout 0.16.0
• git status
• less README.md
• ./autogen.sh
• ./configure
• make
• Don’t make install or make deploy...
• Cf. Antonopolous text, pp. 33ff.
• For Mac help: https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md
• For Linux help: https://bitzuma.com/posts/compile-bitcoin-core-from-source-on-ubuntu/
• For Windows: https://github.com/kobake/bitcoin-msvc (your mileage may vary...)
HOLD ON THAR LITTLE
PARDNER... Yosemite Sam, Miner

Horror Stories
Libertarians are Idealists Too...

“It’s very easy to lose crypto...What people need to understand is this technology was
born out of the cipher-punk movement, using cryptography for people’s individual
freedom and privacy for protection against the state...It was never designed to be user-
friendly, but obviously now people are investing hundreds of billions of dollars into
these systems that are still nascent with respect to the usability and design of the
applications.”—Martin Davidson, co-founder of Blockchain Centre
Horror Stories
• On December 6, 2017, hackers stole 4,700 Bitcoins (∼ $460 million today) in a spear
phishing attack by breaking into Slovenian-based virtual currency marketplace NiceHash
• According to Chainanalysis and Coindesk, a virtual currency exchange, anywhere from
17% up to 33% of the Bitcoins thus-far released and mined have been lost forever
• The reason for disappearance can be anything from losing private keys to hardware
failure.
• The Coindesk study, reported by Fortune, concluded that between 2.78 million and 3.79
million bitcoins—15 to 20 per cent of existing supply—have been lost
• Despite this, there has never been a successful hack of the Bitcoin blockchain itself.
Horror Stories
• Perhaps one of the most infamous stories is that of British IT worker James Howells
who had amassed 7,500 Bitcoins between 2009 and 2010 (worth about £1000 at the
time).
• He kind of forgot about them, and disposed of an old computer which, tragically,
housed an old hard drive which contained his private keys.
• In 2013 after the price of bitcoin had soared from $.01 to over $100 a coin (worth about
£750,000), he remembered his keys…the keys were on that old hard drive...
• As of January 1, 2025, those 7,500 Bitcoins would be worth £591,644,497, or
US$735,000,000
• Rumor has it that the hard drive lies somewhere under tons of landfill in South Wales,
UK.
Horror Stories
• Alex (a pseudonym) is an Australian husband (still we think) who
decided to dabble in bitcoin mining early on.
• In late 2009, when bitcoin was still in its infancy and a single PC
could “mine” a few coins in a day, Alex “got into it just for fun.”
• He managed to mine over 1,000 coins between 2009-2010, storing
his private keys on a USB stick, a smart move.
• Around the end of 2013, after the price peaked to just under $980, he, too, suddenly
remembered his wallet on that USB stick with 1,000 bitcoins.
• The USB stick he’d used to back his keys up on didn’t work...no worries...he had
written down his keys on a sticky note...“Honey, do you remember seeing a yellow piece
of paper about four years ago…I left it on my desk...?”
• Today, his 1,000 bitcoins would be worth roughly US$98,000,000. “Don’t tell my
wife.”
Horror Stories
• In February of 2019, Quadriga, Canada’s largest cryptocurrency exchange, reported it
was unable to gain access to $145 million of bitcoin after its 30-year old CEO and co-
founder, Gerald Cotten, suddenly died of complications arising from Crohn’s Disease
while traveling in India
• Cotten’s widow said that the laptop that her husband had used to run the currency
exchange was encrypted
• Many of the digital currencies held by Quadriga were stored offline in “cold wallets,” as
a way of protecting them from hackers. Cotten was the only person with access to the
wallets, the contents of which were also encrypted
• “I do not know the password...I have not been able to find them written down
anywhere. ”
• Cotten’s death has plunged the exchange into crisis and left it struggling to figure out
how to refund more than 100,000 users
Horror Stories: Mount Gox
• By the first decade of the new millennium, Jed McCaleb, a lover of Japanese culture and
resident of Japan, was running an online trading site that traded playing cards from a game
called “Magic: The Gathering”
• McCaleb called his exchange site Magic The Gathering Online eXchange, or MT GOX
• On July 17, 2010, McCaleb transformed his playing card trading site and released the Mt.
Gox Bitcoin currency exchange, later selling it in March 2011 to Frenchman “MagicalTux,”
Mark Karpelès, who was into Japanese manga and cosplay pastimes
• Karpelès moved Mt. Gox to Tokyo and was at the time about the only place to trade
bitcoins
• The company rode the first meteoric rise of bitcoin in 2010-2011, when around June 13,
2011, investors began to notice that their bitcoins were missing...
Horror Stories: Mount Gox
• Karpelès said the company had lost around 1,000 bitcoins, but when the dust settled, some
850,000 bitcoin private keys (∼US$32 billion) had disappeared and were likely stolen
through multiple siphoning hacks
• Karpelès was arrested in August 2015 in a Japanese police raid while the world reacted with
calls for greater regulation of bitcoin and its exchanges.
• Karpelès was found guilty of the improper use of electronic funds and personally embezzling
a total of $2.7 million of customer funds.
• Although the company later “found” 200,000 bitcoins in a backup, the net loss wound up
being 650,000 coins.
• Last I heard, Karpelès is on bail and cannot leave Japan
Horror Stories: Silk Road
• Ross Ulbricht (aka “Dread Pirate Roberts”) was the pseudonymous proprietor of the
website known as Silk Road, which used Bitcoin for illegal transactions in drugs and arms.
• Between 2011 and 2013, Silk Road became a favorite online marketplace—initially
anonymous to law enforcement agencies—for all sorts of things, including drug mafias,
and a headache for authorities...
• People sold drugs worth millions on the website, and all transactions were done
anonymously using Bitcoin.
• Within months, the website became a leader of the
“darknet”, with over 900,000 users and the annual turnover
of $1 billion—it basically became the Amazon of illicit drugs
• Ulbricht was arrested in October 2013 in a San Francisco
public library by the FBI, and the site was shut down.
• Ulbricht is now serving a life sentence for drug trafficking,
criminal enterprise, aiding and abetting distribution of drugs,
murder-for-hire and money laundering.
Black Eyes: BitInstant
• Charlie Shrem, the 27-year-old CEO of the Bitcoin exchange BitInstant, founded in 2011, was a
young and ambitious entrepreneur who became fascinated with the idea of having a currency no
central authority could control
• After he had bought a couple of bitcoins for a few cents on the dollar at the time, he started the
BitInstant exchange from his home
• He soon caught the attention of young investors like the Winklevoss brothers who invested over
$1.3 million in his company. It began a Boom Time.
• Soon other investors came calling, giants like Walmart, Walgreens, and Duane Reade
• Revenue began to reach over US$1 million a month
• Shrem partnered with a former plumber, “BTCKing” Robert Faiella, whose customers (drug mafias)
were using Silk Road to sell drugs, and both Shrem and Faiella were swept up in the FBI’s Silk Road
dragnet along with the Dread Pirate Roberts, accused of the sale of Bitcoins worth $1 million to Silk
Road.
• Shrem was sentenced to two years in jail and Faiella to four years
• This incident sent shockwaves in the Bitcoin world, as companies like Walgreens and Duane Reade
received a black eye, and world-wide, people started associating bitcoin with money laundering
More Black Eyes: WannaCry?
• The WannaCry ransomware attacked Windows computers in May of 2017 in a
worldwide ransomware cyberattack delivering a cryptoworm
• The virus hit computers of major corporations in over 150 countries throughout the
world.
• Panic spread across the world as message saying “Ooops, your files have been
encrypted!” popped up on the compromised computers.
• The hackers sought $300 ransom in Bitcoin from every compromised computer, giving
people a three-day window to pay the ransom, failing which the hackers threatened to
delete the encrypted files.
• This was yet another black eye on the bitcoin cryptocurrency that was just beginning to
get over its legacy of drugs and black markets
A Recent Horror Story: NiceHash
• NiceHash is a Slovenian cryptocurrency cloud mining marketplace founded in 2014 that
connects sellers of hashing power (miners) with buyers of hashing power, in the form of
pools.
• NiceHash reported on Wednesday, December 6, 2017, that hackers stole nearly around
4,700 Bitcoin private keys worth some $460 million at current prices
• Although NiceHash (nice name after Silk Road...) continues to operate, on December
21, 2017, Marko Kobal resigned as the CEO
• On February 17, 2021 a North Korean hacker group was indicted for the 2017
NiceHash hack
THE DAO FIASCO
“Architecture matters...How a system is designed will affect the freedoms and control
the system enables. And how the internet was designed intimately affected the
freedoms and controls that it has enabled. The code of cyberspace—its architecture
and the software and hardware that implement that architecture—regulates life in
cyberspace generally. Its code is its law.”—Lawrence Lessig, The Future of Ideas, 2001
Libertarians Are Idealists Too
• The DAO (The Decentralized Autonomous Organization) was an investment fund
established on April 30, 2016, at 01:42:58 AM on Ethereum Block 1428757 by Slock.it,
a smart contracts development group founded by one of the partners of Ethereum,
Stephan Tual
• The DAO was to be entirely managed by software, taking Lawrence Lessig’s “code is
law” idea literally in an orgy of libertarian idealism
• Investors could vote online about how to allocate the fund’s money, from a set of
proposed projects
• The DAO was crowdfunded via an Initial Coin Offering (ICO) token sale in May 2016
• The ICO raised more than $34 million by mid-May 2016, and five days later it had
raised over $100 million, with no single investor owning more than 5% of the fund
• The fund’s Ether value as of May 21, 2016, was more than $150 million, and the fund
had more than 11,000 investors
The Warnings
• In May 2016 a paper was published noting several potential security
vulnerabilities associated with The DAO’s code
• Further, an Ethereum developer had pointed out a flaw relating to "recursive calls" in
early June that was picked up and blogged by Peter Vessenes, founder of the Blockchain
Foundation on June 9, 2016
• These warnings were taken seriously and by June 14th fixes had been proposed and were
awaiting approval by members of The DAO (committees move slower than the speed of
the network)
• Further complicating things, on June 13-16 further attention was called to recursive call
vulnerabilities by bloggers affiliated with the The Initiative for CryptoCurrencies &
Contracts
The Sting
• In the early hours of Friday, June 17, 2016, The DAO was subjected to an attack that exploited a
combination of vulnerabilities, siphoning off funds to an impersonator DAO that the hacker(s)
controlled
• By the time they woke up, the hackers had siphoned off almost $55 million worth of ether
• The funds were put into an account subject to a 28-day holding period under the terms of the
DAO contract, so they were not actually gone
• Members of The DAO and the Ethereum community debated what to do next, with some
calling the attack an unethical, but nonetheless, valid “job well done”, saying that when the code
is “its own documentation...this is what happens in the brave new world of programmatic
money flows”
• Others simply called for The DAO to be shut down and remaining funds distributed
• Eventually, the Ethereum network was hard forked to move the funds in The DAO to a recovery
address where they could be exchanged back to Ethereum by their original owners
• However, objectors to the hard fork continued to use the original Ethereum blockchain, now
called Ethereum Classic.
Interest in Blockchain is Skyrocketing
• Get rich mania has continued with new blockchain-based crowdfunding Initial Coin
Offerings (ICOs), wherein most of these new offerings tout a host of new decentralized
applications threatening to disrupt everything from online advertising to medical
research
• The current leader in amounts raised in an ICO is EOS, which quadrupled the previous
winner Telegram whose encrypted-messaging service running over it’s Telegram Open
Network (TON) which allows million of users to pay for services on the TON
blockchain, using the cryptocurrency Gram.
• Telegram raised 1.7 billion dollars in its pre-sale ICO, whereas EOS raised 4.1 Billion in
beginning in June 2018 for its EOS token
Measured in Grams...
• Nonetheless, current fundraising comes at a time when the SEC has grown
increasingly wary of ICOs
• The Wall Street Journal reported in late February 2018, that the SEC had begun issuing
dozens of subpoenas to cryptocurrency-related firms
• In June 2017 Switzerland-based Bancor raised $153 million in just three hours. Within
two years, it plummeted as hackers stole $13.5 million worth of tokens from Bancor’s
decentralized exchange (DEX) and then, in 2019, the platform barred US-based users
due to regulatory uncertainty.
• ICOs are today raising billions of dollars, and steemit.com has issued a tongue-in-cheek
instruction manual for creating your own ICO scam:
https://steemit.com/scam/@moonjelly/how-to-create-an-ico-scam-in-5-simple-steps

You might also like