Bitcoin Knowledge How Bitcoin Works at a Technical Level (Part 1) By Ryan Brewer @rhunbre v1
DISCLAIMER This content is intended to be used, and must be used, for informational purposes only. Always perform your own analysis before making any investment, and take your own personal circumstances into account during such analysis. Bitcoin is about individual empowerment, not hand-holding, and you should seek independent financial advice from a professional in connection with, or independently research and verify yourself, any of the following information which you wish to rely upon, whether for the purpose of making an investment decision or otherwise. By Ryan Brewer (rhunbre) v1
WHAT IS BITCOIN? • Bitcoin is a cryptocurrency that was launched January 3, 2009. • cryptocurrency: a digital asset, serving as a medium of exchange that uses cryptography to secure transactions and control money supply • But… Bitcoin is so much more! • A Distributed, Global, Immutable Public Ledger • A Public Key Infrastructure (PKI) • A Smart Contracts Platform • A Timestamping Service • An Energy Arbitrage Method By Ryan Brewer (rhunbre) v1
WHAT IS BITCOIN? Bitcoin is… • Decentralized • Bitcoin nodes only connect to other peers. • Global • Bitcoin is borderless. • Immutable • Bitcoin transactions accumulate reversal difficulty over time. • Pseudonymous • Bitcoin payments are only identified with a cryptographic pseudonym. • Trustless • Bitcoin requires no trust in individual users, only in the protocol itself. By Ryan Brewer (rhunbre) v1
WHAT IS A DECENTRALIZED NETWORK? Node Type Key client / peer subserver server CENTRALIZED DISTRIBUTED DECENTRALIZED one node does nodes nodes are only everything distribute work connected to to subnodes peers By Ryan Brewer (rhunbre) v1
WHAT IS BITCOIN? • Bitcoin is not yet fully anonymous. It is weakly pseudonymous by default, and anonymity can be enhanced by following best practices and using developing privacy solutions (such as JoinMarket). • Better, and perhaps true, anonymity can be expected in the future as additional features and improvements continue to be added to, and built on top of, Bitcoin. • Bitcoin uses a structure known as a “blockchain” to store transaction data. By Ryan Brewer (rhunbre) v1
WHAT IS BITCOIN? • Bitcoin has no central bank, or issuer. Instead, bitcoins are created according to a predictable supply schedule that is controlled through a process known as “mining.” • This mining process ensures that a maximum of only 21 million bitcoins can ever be created (but in practice, available supply will be lower). • Each bitcoin can be subdivided into one hundred million subunits, which are called satoshis. By Ryan Brewer (rhunbre) v1
WHAT IS BITCOIN? • Once a transaction has been added to a block, it is considered “finalized”, which means irreversible up to some economic cost, which increases rapidly as blocks are added on top. • Bitcoin transactions have a strong guarantee of irreversibly after one block, and a very strong guarantee after six blocks. • For comparison, credit card finalization time is measured in months. By Ryan Brewer (rhunbre) v1
WHAT IS BITCOIN? • Some of the techniques, or methods, that Bitcoin uses: • public key cryptography • cryptographic hash functions • a blockchain (shared public ledger) • a hashcash style proof-of-work (used for mining) • a peer-to-peer network for passing messages • consensus algorithm (or consensus rules), enforced through mining AND by non-mining full nodes • a virtual machine (the Bitcoin script language) By Ryan Brewer (rhunbre) v1
PUBLIC KEY CRYPTOGRAPHY • Public key cryptography, also called asymmetrical cryptography, uses pairs of keys, a public key which may be disseminated widely, and a private key which is known only to the owner. • Each Bitcoin unspent output (UTXO) is associated with a public ECDSA key. • When you send bitcoins, your Bitcoin software creates a message, called a transaction, that assigns ownership to the specified public keys (as Bitcoin addresses). • Useful for authentication and encryption. By Ryan Brewer (rhunbre) v1
CRYPTOGRAPHIC HASH FUNCTIONS • A hash function can be used to map data of an arbitrary size to data of a fixed size. The output value is called a hash value, hash code, digest, or simply hash. • A cryptographic hash function is designed to also be a one-way function that is infeasible to reverse. An ideal cryptographic hash function can only be reversed via brute-force search or prior knowledge. • Bitcoin currently uses SHA-256 and RIPEMD-160. • SHA-256 Examples • In: hello, Out: 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 • In: Hello, Out: 185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969 By Ryan Brewer (rhunbre) v1
THE BITCOIN BLOCKCHAIN • A blockchain (originally written as block chain) is a constantly growing set of blocks (sets of transactions) which are linked and secured using cryptography (specifically, cryptographic hash functions). • In Bitcoin, each block contains the double SHA-256 hash of the previous block. • The first version of Bitcoin simply counted block height to determine the longest valid chain. Bitcoin now counts the cumulative work instead. By Ryan Brewer (rhunbre) v1
THE BITCOIN BLOCKCHAIN Block “Type” Key genesis main orphan By Ryan Brewer (rhunbre) v1
PROOF-OF-WORK • Hashcash is a proof-of-work algorithm which requires a tunable amount of work to calculate, but for which the proof can be easily and quickly verified. • Hash for Bitcoin Block 496900: 000000000000000000862f936c57d9c4df596fa50408017511c763f66677ccad By Ryan Brewer (rhunbre) v1
PEER-TO-PEER NETWORK • A peer-to-peer (P2P) network is a distributed application architecture that allows communication and coordination between peers. • Peers are equally privileged participants in the network. • Some Message Types in Bitcoin: version, verack, addr, inv, getdata, notfound, getblocks, getheaders, tx, block, headers, getaddr, mempool, checkorder, submitorder, reply, ping, pong, reject, filterload, filteradd, filterclear, merkleblock, alert, sendheaders, feefilter, sendcmpct, cmpctblock, getblocktxn, blocktxn By Ryan Brewer (rhunbre) v1
CONSENSUS RULES • There is a set of network level consensus rules for block validation that full nodes MUST follow to stay in consensus with other full nodes. • Nodes can tighten these rules, such as refusing to relay otherwise valid transactions. • But if they attempt to loosen the rules, such as broadcasting invalid transactions or blocks, the rest of the network will ignore them. By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG <sig> <pubKey> By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG <pubKey> <sig> By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG <pubKey> <sig> By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG <sig> By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG <pubKey> <pubKey> <sig> By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG <pubKeyHash> <pubKey> <sig> By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example OP_EQUALVERIFY OP_CHECKSIG <pubKeyHash> <pubKeyHash> <pubKey> <sig> By Ryan Brewer (rhunbre) v1
BITCOIN SCRIPT, AKA VIRTUAL MACHINE Pay To Public Key Hash (P2PKH) Example OP_CHECKSIG <pubKey> <sig> By Ryan Brewer (rhunbre) v1
PRICE HISTORY OF ONE BITCOIN By Ryan Brewer (rhunbre) v1
Recommend
More recommend