IntroFiat & Digital Currency:List some currency nowadaysDescribe simple online payment> disadvantage and how bitcoin solve itBitcoin internalGo from user view to technical viewHow bitcoin workTheory it based on
3 Functions of money:Medium of exchange – money is used to intermediate the exchange of goods and services, thusly avoiding the problems connected with barter system Unit of account – money is used as a unit of market value of goods and services Store of value – money can be stored and spent in a later point of time reliably fiat currency:Inflation
How it worksStep1: User go to the ecommerce site (eg: tiki.vn), choose books.Step2: User input card info, go to payment site.Bank validate the transaction and update account value-> It has some problems. See next slides
It involves a trusted third party and implies some cost. transaction fails but $ gone away -> it take time & cost to process.It store all information & transaction histories. Easy tracingCompletely non-reversible transactions Eg: risk for tiki when the transaction is reversible
How to solve them with bitcoinIn November 2008, a paper was posted on the internet under the name Satoshi Nakamoto titled Bitcoin: A Peer-to-Peer Electronic Cash System. This paper detailed methods of using a peer-to-peer network to generate what was described as "a system for electronic transactions without relying on trust“In January 2009, the Bitcoin network came into existence with the release of the first open source Bitcoin client and the issuance of the first bitcoins, with Satoshi Nakamoto mining the first block of bitcoins ever (known as the "genesis block"), which had a reward of 50 bitcoins.Source code: https://github.com/bitcoin/bitcoin - public from 2010What Characteristic of Bitcoin[No]On 6 August 2010, a major vulnerability in the Bitcoin protocol was spotted. Transactions weren't properly verified before they were included in the transaction log or "block chain" which let users bypass Bitcoin's economic restrictions and create an indefinite number of bitcoins. On 15 August, the vulnerability was exploited; over 184 billion bitcoins were generated in a transaction, and sent to two addresses on the network. Within hours, the transaction was spotted and erased from the transaction log after the bug was fixed and the network forked to an updated version of the Bitcoin protocol. This was the only major security flaw found and exploited in Bitcoin's history
Commodity: like goldEmission is programmed: every 10 min. 50 coins are created. It number decrease twice every 4 years.theory: cryptographic how to verify transaction, mining…You can see the characteristic clearly when go deep in bitcoiniternal
Safe usage require basic knowledge
First one, you need a account for receive or send bitcoin to others. It is address in bitcoin view.Address: - No personal info - create online or offline - can use temporaryClient like website bank for perform operationStandard client: peer 2 peerIn cryptography, the Elliptic Curve Digital Signature Algorithm (ECDSA) offers a variant of the Digital Signature Algorithm (DSA) which uses elliptic curve cryptography.Pool – A Pool is a website that allows Miners to collaborate together in creating new Blocks. How to create Bitcoin Address https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses0 - Having a private ECDSA key 18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725 1 - Take the corresponding public key generated with it (65 bytes, 1 byte 0x04, 32 bytes corresponding to X coordinate, 32 bytes corresponding to Y coordinate) 0450863AD64A87AE8A2FE83C1AF1A8403CB53F53E486D8511DAD8A04887E5B23522CD470243453A299FA9E77237716103ABC11A1DF38855ED6F2EE187E9C582BA6 2 - Perform SHA-256 hashing on the public key 600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408 3 - Perform RIPEMD-160 hashing on the result of SHA-256 010966776006953D5567439E5E39F86A0D273BEE 4 - Add version byte in front of RIPEMD-160 hash (0x00 for Main Network) 00010966776006953D5567439E5E39F86A0D273BEE 5 - Perform SHA-256 hash on the extended RIPEMD-160 result 445C7A8007A93D8733188288BB320A8FE2DEBD2AE1B47F0F50BC10BAE845C094 6 - Perform SHA-256 hash on the result of the previous SHA-256 hash D61967F63C7DD183914A4AE452C9F6AD5D462CE3D277798075B107615C1A8A30 7 - Take the first 4 bytes of the second SHA-256 hash. This is the address checksum D61967F6 8 - Add the 4 checksum bytes from stage 7 at the end of extended RIPEMD-160 hash from stage 4. This is the 25-byte binary Bitcoin Address. 00010966776006953D5567439E5E39F86A0D273BEED61967F6 9 - Convert the result from a byte string into a base58 string using Base58Check encoding. This is the most commonly used Bitcoin Address format 16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM
How bitcoin define coin (eg: 1 bitcoin)Coin = list of transaction. It store history usage of the coins. Transactions: A transaction is a record of where is money coming from, where it is going and how much is being transferred. Ex: 1. System send to A 50 BTCs2. A send 50BTCs to B3. B send 50BCs to CThe transactions chain is public. Everyone know it.Given a transaction chain, how to know who ownership?Base on last transaction in chain. given by digital signature of transaction by last ownerEveryone has public key of owner, every know owner of specific bitcoinsWho can send the coin?Only owner have suitable private key to sign and send to othersOutput of transaction chainit is chain in user view. It computer, it has fix length.
A transaction has many input or output.Input: previous transactionWhy it has many input?Eg: A has 20 coins. Because coins is in bitcoin is transaction chain.(Note: It does not means that a bit coin is a transaction chain. Transaction chain has a variable indicate coin amount.)A has 2 transaction chains. 15 and 5. So if A want to spend 17coins?-> 2 inputs make sense.Why it has many output?Above example, How to receive back 3 coins? In bitcoin, It do add one output as address of owner.
Imagine that: if transaction exists solo. Who sure owner don’t use a transaction chain to spend many times for many products?The problem of course is the payee can't verify that one of the owners did not double-spendthe coin. A common solution is to introduce a trusted central authority, or mint, that checks everytransaction for double spending.
Bitcoin solution:It will build a public transaction log that called block chain. All transactions in the block chain are all valid. Everyone want to validate a transaction valid or not, double spending or not. They only check it has pre-transaction comes from the block chain.How to implement? Build a block chain - publicGiven a existent chainCollect info: new transaction, … to build a new block, add into the chainVery difficult to build a similar chain?SolutionIt will base on crypt theory make very difficult to build a block chain has same length. It take a lot of effort of computers.-> every one build it.Difficult -> base on proof-of-work
Bitcoin solution:It will build a public transaction log that called block chain. All transactions in the block chain are all valid. Everyone want to validate a transaction valid or not, double spending or not. They only check it has pretransaction comes from the block chain.How to implement?Build a chain and everyone know it.Very difficult to build a similar chain?SolutionIt will base on crypt theory make very difficult to build a block chain has same length. It take a lot of effort of computers.
To implement a distributed timestamp server on a peer-to-peer basis, we will need to use a proof-of-work systemA proof of work is a piece of data which was difficult (costly, time-consuming) to produce so as to satisfy certain requirements.The work is try and tryOnce the CPU effort has been expended to make it satisfy the proof-of-work, the block cannot be changed without redoing the workSteps:Init none = 0Calculate block header hashCompare to TargetSmaller -> Send to networkNot, try to increase none
To implement a distributed timestamp server on a peer-to-peer basis, we will need to use a proof-of-work systemA proof of work is a piece of data which was difficult (costly, time-consuming) to produce so as to satisfy certain requirements.The average work required is exponential in the number of zero bits required and can be verified by executing a single hash.Once the CPU effort has been expended to make it satisfy the proof-of-work, the block cannot be changed without redoing the work
If network accept, the miner get awardsIf no, another one aldready build new block first, no award. Re-mining with new transactions.Target: The target is a 256-bit number (extremely large) that all Bitcoin clients sharedifficulty = difficulty_1_target / current_targetHow often does the network difficulty change?Every 2016 blocks. At the desired rate of one block each 10 minutes, 2016 blocks would take exactly two weeks to findCurrent target: 15 leading zeros0000000000000001A36E00000000000000000000000000000000000000000000
Why need Merkle Root tree?The idea (as I understand it) is that the Merkle tree allows for you to verify transactions as needed and not include the body of every transaction in the block header, while still providing a way that the entire blockchain (and therefore proof of work) on every transaction.See http://bitcoin.stackexchange.com/questions/10479/what-is-the-merkle-root
Lưu Tuấn Cường
Fiat and Digital Currency
Mining & Proof-of-work
The currency we use today is
at fiat currency: its value is
entirely determined by
government policy and law.
It is not a commodity (like
gold). Any amount of money
could be created without
3 functions of money:
Medium of exchange
Unit of account
Store of value
Digital Currency: Digital currency is a form of money
or script that is only executed electronically. Typically,
this involves the use of computer networks, the
Internet and digital stored value systems.
Electronic funds transfer, direct deposit, digital gold
currency and virtual currency are all examples of
It involves a trusted third party and implies some cost.
Completely non-reversible transactions are not really
possible. More risks for merchants.
Bitcoin is the name of the project started by Satoshi
Nakamoto to create the world’s first decentralized
digital crypto-currency in 2009.
Digital: it is just a record of transactions (a ledger).
Decentralized: the ledger is public; validation of the
ledger is made by a peer-to-peer network.
Bitcoin is the name of a single unit of the Bitcoin
currency (BTC). 1 BTC = 100.000.000 Satoshis.
Characteristic of Bitcoin
Commodity: Hard limit of about 21 million BTCs
Based on cryptographic proof instead of trust
Transactions are cheap, and mostly free
Characteristic of Bitcoin
Degree of acceptance: Many people are still unaware
Ongoing development: Bitcoin software is still in
beta with many in complete features in active
Take time to verify transactions.
Require basic knowledge when use bitcoin.
Some terms (1)
Address (account): 160-bit hash of the public portion of a
public/private ECDSA key pair
Wallet: Bitcoin addresses (the public keys) and their associated
private keys are stored in the wallet data file
Client: an application used by the users to perform operations
on the Bitcoin Network.
Standard Client: an application developed by the original
developers working on the Bitcoin project. It sets the standards
of how Clients should work and communicate with each other.
Some terms (2)
Miner: A Miner is a computer machine and accompanying
application dedicated to creating new Blocks.
Satoshi Nakamato, 1998:
“We define a digital coin as a chain of digital signatures"
A coin is defined by the
list of its transactions.
Proof of ownership is
given by digital signature
of transaction by last owner
Transaction - Problem
Double-Spending: The payee can't verify that one of the owners
did not double-spend
A timestamp server takes a hash of a block of items to be
timestamped and widely publishing the hash. The timestamp
proves that the data must have existed at the time in order to get
into the hash. Each timestamp includes the previous timestamp in
its hash, forming a chain , with each additional timestamp
reinforcing the ones before it.
Bitcoin miners find a random number (called a "Nonce") that
when inserted into the current block makes the hash (SHA-256)2
be below the current target. The average work required is
exponential in the number of zero bits required and can be verified
by executing a single hash
Hash of the last block (shortened to 30 characters):
Hash of a few valid transactions waiting for inclusion (shortened):
One special transaction - mining award:
(2 leading zeros)
Nonce = 0
Block Hash: 8b9b994dcf57f8f90194d82e234b72ac -> No luck! No leading
Nonce = 1
Block Hash : 5b7ce5bcc07a2822f227fcae7792fd90 -> No luck! No leading
Nonce = 1000:
Block Hash : 0005e55df5758517c9bed0981b52ce4a -> Ok
Send the block to the Bitcoin network.
The steps to run the network are as follows:
1) New transactions are broadcast to all nodes.
2) Each node collects new transactions into a block.
3) Each node works on finding a difficult proof-of-work for its block.
4) When a node finds a proof-of-work, it broadcasts the block to all
5) Nodes accept the block only if all transactions in it are valid and
not already spent.
6) Nodes express their acceptance of the block by working on
creating the next block in the chain, using the hash of the accepted
block as the previous hash.
Wallet Is Vulnerable