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 ● Bitc
Trang 1Bitcoin: The Hype, The Myth and The Truth
~ Part 2 - 6/11/2017 ~
Tran Duc Thang
-~ A Technical Overview about How Bitcoin works -~
Trang 2● 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
Trang 33
The purpose of this Seminar is to
explain How Bitcoin works,
not to encourage you to buy Bitcoin.
Trang 4● Peer-to-Peer Electronic Cash System
Trang 5Block Structure
5
Field Description Size
Magic Number value always 0xD9B4BEF9 4 bytes
Blocksize number of bytes following
up to end of block 4 bytesBlockheader consists of 6 items 80 bytes
Transactions the list of transactions
Trang 6● 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.
Block Structure - Merkle Tree
Trang 7Block Structure - Merkle Tree
7
Trang 8Merkle root is cryptographic proof of which
transactions are included in the block, and which
order they are in
Block Structure - Merkle Tree
Trang 9Block Structure - Block Header
9
Field Purpose Updated when Size
(bytes)
Version Block Version Number Upgraded software
provides newer version 4
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
Trang 10● 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.
Proof-of-work
Trang 11● 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
successors and redoing the work they contain This
protects the block chain from tampering.
algorithm
Proof-of-work
11
Trang 12● 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
Proof-of-work
Trang 13What happens if two blocks are mined nearly at the
Trang 14“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 ~
Trang 15● 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
Bitcoin Mining
15
Trang 16● 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)
Bitcoin Mining
Trang 17Bitcoin Mining
17
Trang 18● 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
Bitcoin Mining
Trang 19An 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
Bitcoin Mining
19
Trang 20● 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.
Bitcoin Mining
Trang 21Bitcoin Mining
21
Trang 22Bitcoin Mining
Trang 23● 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
Bitcoin Problems
23
Trang 24● 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).
Bitcoin Problems - Majority Attack
Block n Block n + 1 Block n + 2 Block n + 3
Block n + 2 Block n + 3 Block n + 4
Trang 25With the majority hashing power, the attacker CAN:
● Reverse transactions that he sends while he's in control
This has the potential to double-spend transactions that
previously had already been seen in the block chain
● Prevent some or all transactions from gaining any
Trang 26With the majority hashing power, the attacker CAN NOT:
● Reverse other people's transactions without their
cooperation
● Change the number of coins generated per block
● Send coins that never belonged to him
Bitcoin Problems - Majority Attack
Trang 27Bitcoin Network is secured by
Hashing Power (hashrate)
Bitcoin Problems - Majority Attack
27
Trang 28Bitcoin, a “Cash System” or “Digital Gold”?
Bitcoin Problems
Trang 29● Chain fork: the occurrence of multiple blocks at the
same height
invalidate previous transactions Soft fork provides
backward compatibility.
previously invalid events valid Hark fork is not
backward compatible.
Bitcoin Fork
29
Trang 30● Soft Fork and Hard Fork can lead to a chain split
● A chain split is the state of the network when
mining is based on more than one chain at the
same time
Bitcoin Fork
Trang 31● The one-megabyte limit has created a
bottleneck in bitcoin, resulting in increasing
transaction fees and delayed processing of
transactions that cannot be fit into a block
○ Make a bigger Block
○ Change the way of constructing Transaction
and Block
Scaling Bitcoin
31
Trang 32● Increase the block size limit
● Require a hard fork
● On-chain scaling
Scaling Bitcoin: Big Block
Trang 33● Segregated Witness, or SegWit, is the name
used for a soft fork change in the transaction
format It removes (segregate) the script and
signature data (witness) from transaction
● Require a soft fork -> already activated on
Trang 34● Bitcoin whitepaper: https://bitcoin.org/bitcoin.pdf
● Bitcoin wiki: https://en.bitcoin.it/wiki/Main_Page
● Bitcoin forum: https://bitcointalk.org/
● Bitcoin Reddit: https://www.reddit.com/r/Bitcoin/ and
Trang 35Thank you for listening!
35