Bitcoin: The Hype, The Myth and The
Truth
~ A Technical Overview about How Bitcoin works ~
~ Part 2 - 6/11/2017 ~
Index
●
What is Bitcoin? Review
The Block and the Chain in depth
Proof-of-work Algorithm
Bitcoin Mining
Bitcoin problems and weakness - The Truth about 51% Attack
Bitcoin Soft fork vs Hard fork
Bitcoin Scaling: On-chain vs Off-chain
2
Disclaimer
The purpose of this Seminar is to explain How Bitcoin
works,
not to encourage you to buy Bitcoin.
3
What is Bitcoin? - Review
●
●
●
●
Peer-to-Peer Electronic Cash System
Decentralized
No trusted third parties (trustless)
Cryptographic Proof
4
Block Structure
Field
Description
Size
Magic Number
value always 0xD9B4BEF9
4 bytes
Blocksize
number of bytes following up to end of
4 bytes
block
Blockheader
consists of 6 items
Transaction counter
Transactions
80 bytes
1 - 9 bytes
the list of transactions
5
Block Structure - Merkle Tree
●
A tree constructed by hashing paired data (the leaves), then pairing and hashing the
results until a single hash remains
●
●
The final hash is called Merkle Root
The leaves are almost always transactions from a single block.
6
Block Structure - Merkle Tree
7
Block Structure - Merkle Tree
Merkle root is cryptographic proof of which transactions are included in the
block, and which order they are in
8
Block Structure - Block Header
Field
Purpose
Updated when
Size
(bytes)
Version
Block Version Number
Upgraded software provides newer
4
version
Prev Block Hash
Hash of the previous block header
New block comes in
32
Merkle Root Hash
Hash based on all transaction in the block
Transactions list inside a block changes
32
Time
Current timestamp
Every few seconds
4
Bits
Current target
Difficulty is adjusted
4
Nonce
A random number
A hash is tried
4
9
Proof-of-work
●
A proof of work is a piece of data which is difficult (costly, time-consuming)
to produce but easy for others to verify and which satisfies certain
requirements.
●
●
Bitcoin uses the Hashcash proof of work system.
In order for a block to be accepted by network participants, miners
must complete a proof of work which covers all of the data in the
block.
10
Proof-of-work
●
For a block to be valid it must hash to a value less than the current target; this
means that each block indicates that work has been done generating it.
●
Changing a block requires regenerating all successors and redoing the work they
contain. This protects the block chain from tampering.
●
Bitcoin use SHA-256 as the Proof-of-Work hashing algorithm
11
Proof-of-work
●
●
The target is a 256-bit number that all Bitcoin clients share
The lower the target, the more difficult it is to generate a block.
12
Proof-of-work
What happens if two blocks are mined nearly at the same time?
Block n + 2
Block n
Block n + 1
Block n + 2
13
Proof-of-work
“The only way for everyone to stay on the same page is to believe
that the longest* chain is always the valid one, no matter what.”
~ Nakamoto Satoshi ~
14
Bitcoin Mining
●
Mining is the process that:
○
○
Adds valid transactions into a block
Finds the nonce, so that the hash of the block header is lower than or
equal to the network’s current target
○
●
Adds more bitcoins to circulation (create new bitcoins)
Miners use Computing Power to mine Bitcoin
15
Bitcoin Mining
●
●
Computing Power is measured by Hash Rate
Hash Rate is the speed at which a compute is completing an operation in
the Bitcoin code.
●
A higher hash rate is better when mining as it increases your
opportunity of finding the next block and receiving the reward.
●
Current total network hashrate is about 10 EH/s
(10,000,000,000,000,000,000 Hash/s)
16
Bitcoin Mining
17
Bitcoin Mining
●
●
Early Bitcoin client versions allowed users to use their CPU to mine.
After that, the advent of GPU mining made CPU mining financially unwise
as the hashrate of the network grew to such a degree that the amount of
bitcoins produced by CPU mining became lower than the cost of power to
operate a CPU
●
Nowadays, GPU is also unprofitable to mine
18
Bitcoin Mining
An application-specific integrated circuit, or
ASIC, is a microchip designed and manufactured
for a very specific purpose.
ASICs designed for Bitcoin mining were first
released in 2013
19
Bitcoin Mining
●
As more and more miners competed for the limited supply of blocks, individuals found that
they were working for months without finding a block and receiving any reward
for their mining efforts. This made mining something of a gamble.
●
Miners then started organizing themselves into pools so that they could share rewards
more evenly.
20
Bitcoin Mining
21
Bitcoin Mining
22
Bitcoin Problems
●
●
●
●
●
Bitcoin is hard to understand, and requires users to be well versed in computer security
Bitcoin transactions verification is slow
Bitcoin transaction fee is high* (for small transactions)
Bitcoin has no built-in consumer protection
Bitcoin has technical weaknesses vulnerable to orchestrated attacks
23
Bitcoin Problems - Majority Attack
●
A majority attack, or 51% attack is a potential attack on the bitcoin network whereby an
organization is somehow able to control the majority of the network mining power
(hashrate).
Block n
Block n + 1
Block n + 2
Block n + 3
Block n + 2
Block n + 3
Block n + 4
24
Bitcoin Problems - Majority Attack
With the majority hashing power, the attacker CAN:
●
Reverse transactions that he sends while he's in control. This has the potential to doublespend transactions that previously had already been seen in the block chain.
●
●
Prevent some or all transactions from gaining any confirmations
Prevent some or all other miners from mining any valid blocks
25