不是書評(12) The Basics of Bitcoins and Blockchains

An Introduction to Cryptocurrencies and the Technology that Powers Them by Antony Lewis

噢魚
不是書評 — 我的閱讀筆記

--

簡介

不是書評已般家了

本書作者以非常淺白的語言和例子比介紹了特幣和區塊鏈基礎知識。內容涵蓋了諸如比特幣的歷史、比特幣區塊鏈以及比特幣購買、銷售和挖礦等主題。

我的評分

啟發性:8 / 10

實用度:8 / 10

知識增長:9 / 10

趣味性 :8 / 10

內容理解:7 / 10

作者追隨:8 / 10

推介: 8 / 10

閱讀筆記

Some Basic Definitions

  • Cryptocurrencies or coins are assets or items of value that exist digitally, not physically, and are created by software. They have no issuer and no person, company, or entity backs these, and there are no terms of service or guarantees associated with them.
  • Cryptocurrencies are types of cryptographically secured digital assets, sometimes known as cryptoassets.
  • Units of cryptocurrencies are unique data items whose ownership can be passed from account to account (addresses). When these digital assets move from one account to another they are all recorded on their respective transaction databases known as blockchains.
  • All transactions related to cryptocurrencies and tokens are recorded on blockchains: replicated databases that act as the ultimate books and records.
  • Different blockchains have different characteristics. Some blockchains, like Bitcoin and Ethereum chains, are public, or permissionless, meaning that their list of transactions can be written to by anyone, with no gatekeepers to approve or reject parties who want to create blocks or participate in bookkeeping. Other blockchains can be private or permissioned, in that there is a controlling party who allows participants to read or write to them.
  • Each Cryptocurrency is a bunch of protocols: rules that define and characterize the coin itself — what it is, how ownership is represented and recorded, what constitutes a valid transaction, how new participants can join the network of operators, how participants should behave if they want to be kept up to date with the latest transactions, and so on.
  • Bitcoin protocols are written out as Bitcoin code which is run as Bitcoin software which creates Bitcoin transactions containing data about Bitcoin coins recorded on Bitcoin’s blockchain.

Cash vs Digital Money

  • Cash — Once you have cash, it is yours, it is under your control, and you can transfer it again immediately to somebody else. Drawback: it doesn’t work at a distance.
  • (Traditionally) Digital money relies on bookkeepers who are trusted by their customers to keep accurate accounts of balances they hold. Unlike cash, which settles using the transfer of physical tokens, digital money settles by increasing and decreasing balances in accounts held by trusted intermediaries.
  • Cash is an anonymous bearer asset which does not record or contain identity information, unlike many forms of digital money that by law require personal identification.

Standard Definitions of Money

  1. Medium of exchange — you can use it to pay someone for something, or to extinguish a debt or financial obligation.
  2. Store of value — in the near term (however you define this) your money will be worth the same as it is today.
  3. Unit of account — it is something that you can use to compare the value of two items, or to count up the total value of your assets.
  • Almost all government currencies consistently loses value by design, driven by policy. This is known as price inflation (as opposed to currency inflation which is an increase in the number of dollars in circulation).
  • In terms of the ‘store of value’ function of money, it is more the short-term predictability of value, or spending power. But for long term preservation of value, perhaps housing or land or other assets may be more reliable.

Do cryptocurrencies meet the standard definition of money? (Bitcoin example)

  • Bitcoin as a Medium of Exchange — currently not widely accepted by a global standard. In reality, most of the companies who say that they accept Bitcoin as payment don’t actually accept bitcoins or hold them on their balance sheets. Instead, they use cryptocurrency payment processors (e.g. Bitpay) that act as an intermediary by quoting a price to the customer in bitcoins (based on current prices of bitcoins to dollars on various cryptocurrency exchanges), accepting the bitcoins from the customer, then wiring an equivalent amount of conventional currency the boring way into the merchant’s bank account.
  • Bitcoin as a Store of Value — its volatility makes it a nauseating store of value. The supply of Bitcoin is capped to almost 21 million BTC and not subject to arbitrary creation, unlike fiat currencies. Limiting the supply of something can help maintain its value if demand is stable or increases, though the downside of a known, predictable, and completely inelastic supply unrelated to a fluctuating demand results in perpetual price volatility, which is not good if you are looking for price stability.
  • Bitcoin as a Unit of Account — Bitcoin fails miserably, due to its price volatility against USD and everything else in the world.
  • Bitcoin price stability is determined more by the liquidity of a market (how many people are willing to buy and sell at any price point), than the price of an asset. Bitcoin’s supply is inelastic. If there is a spike in demand, there is no impact on the rate at which bitcoins are generated, unlike normal goods and services, so there is no dampening effect on the price.

Forms of Money in History

  1. Barter
  2. Commodity money — the physical token that is transacted is itself valuable, for example grain, which has intrinsic value, or precious metals, which have extrinsic value.
  3. Representative Money — of money whose value is derived by being a claim on some underlying item, for example a receipt from a goldsmith for some gold they are safekeeping. i.e. the value of the token is backed by the value of the underlying asset.
  4. Fiat Currency — is money because legislation says so, rather than because it has a fundamental or intrinsic value. Fiat money neither has intrinsic value nor is it convertible.
  • Both Fiat and Cryptocurrencies do not have intrinsic value
  • Fiat currencies are valuable because 1)they are declared by law as legal tender, meaning that in that legal jurisdiction it must be accepted as valid payment for a debt. Therefore people use it. 2) Governments accept only their own fiat for tax payments. This gives fiat currencies a fundamental usefulness, as everyone needs to pay tax.
  • The two underlying factors in Bitcoin that create demand are (instead of scarcity): 1)It is the most recognised instrument of value that can be transmitted across the internet without needing permission from specific intermediaries. 2) It is censorship resistant.

Quantitative Easing (QE)

  • QE is a euphemism for an issuing authority (generally a central bank) increasing the amount of fiat money in circulation in order to stimulate a flagging economy.
  • The central bank buys assets, usually bonds, from the private sector (commercial banks, asset managers, hedge funds, etc) in the secondary market to add money, or by selling financial assets to the private sector to remove money.
  • Central banks have financial relationships with certain commercial banks called clearing banks, who have accounts called reserve accounts with the central bank. So central banks buy bonds from clearing banks, and they pay by crediting the banks’ reserve account with new money.
  • Risks of QE — 1) With excessive QE, the value of money will go down as there is more of it sloshing around in the private sector, which is not great for savers, and could also cause price inflation . 2) A central bank owns risky financial assets that could go down in value, damaging the central bank’s balance sheet when the value of the assets it owns falls. We can see the impact that QE has had on central bank balance sheets since the most recent global financial crisis.

Digital Money Transaction

  • The digital money world deals with this by using a bookkeeper who is an independent third party, who, because they are regulated, can be trusted to maintain accurate books and records and abide by certain rules.
  • For in-country banks transactions
  1. If both customers bank with the same bank, then that bank itself clears the transaction.
  2. If two banks have a ‘correspondent banking’ relationship, then the receiving bank clears the transaction.
  3. If there is a central bank system — a RTGS or DNS — then the central bank clears the transaction.
  • For Cross border transaction (Same currency) — The bank in country A has an account with a correspondent bank licensed in the country B of the currency.

Cryptography

  • Cryptography is about sending secret messages that can be read only by the intended recipient.
  • Encryption is the process of turning a plaintext (i.e., readable) human message into cyphertext (a jumble, gobbledegook), so that if the encrypted message is intercepted a snooper can’t understand it.
  • Decryption is the process of turning the gobbledegook cyphertext back into readable plaintext.
  • Symmetric encryption — the same key is used in both the encryption and decryption stages.

Public Key Cryptography

  • Using asymmetric cryptography, if you want to receive encrypted messages you create two mathematically linked keys: a public key and a private key. Together they are called a key pair. You can share your public key with the world, and anyone can use it to encrypt messages for you. You use your private key, known only to you, to decrypt those messages.
  • Bitcoin uses a different scheme called ‘ECDSA’ — Elliptic Curve Digital Signature Algorithm. It works like this:
  1. Pick a random number between 0 and 2256–1 (that, written out, has seventy-eight digits: 115, 792, 089, 237, 316, 195, 423, 570, 985, 008, 687, 907, 853, 269, 984, 665, 640, 564, 039, 457, 584, 007, 913, 129, 639, 935). This is your private key.
  2. Do some ECDSA maths on it to generate a public key. The ECDSA algorithms are well known and there are plenty of tools to help with the calculations.
  • It was easy for you to convert your private key into a public key by doing some ECDSA maths on it, it is mathematically impossible for someone to ‘work backwards’ and derive your private key from your public key. www.bitaddress.org
  • Bitcoin addresses (accounts) are derivatives of public keys. When you make a Bitcoin transaction, you use your private key to sign, or authorize, the transaction which moves bitcoins from your account to someone else’s.
  • Digital assets are held in accounts made from public keys, and the respective private keys are used for signing outbound transactions.

Hashes

  • A hash function is a series of mathematical steps or algorithms that you can perform on some input data, resulting in a fingerprint, or digest, or simply, a hash. The output of a hash function is of fixed size
  • A cryptographic hash function is special and has some characteristics that makes it useful in cryptography and for cryptocurrencies,
  1. It is deterministic so the same message always results in the same hash It is quick to compute the hash value for any given message (you can easily go ‘forwards’)
  2. It is not feasible to generate a message from its hash value except by trying all possible messages (you can’t go ‘backwards’)
  3. A small change to a message should change the hash value so extensively that the new hash value appears uncorrelated with the old hash value (a small change makes a big difference)
  4. It is not feasible to find two different messages with the same hash value (it is hard to create a hash clash)
  • Hash functions can be used for proving that two things are the same without revealing the two things.
  • Established industry standard cryptographic hash functions include MD571 (Message Digest) and SHA-256 (Secure Hash Algorithm),
  • Cryptographic hashes, the output from cryptographic hash functions, are used in Bitcoin in a number of places:
  1. In the mining process
  2. As identifiers for transactions
  3. As identifiers for blocks, in order to link them in a chain
  4. Ensuring that data tampering is immediately evident

Digital signatures

  • Digital signatures are a subset of electronic signatures, which can take a number of forms.
  • A digital signature is created by taking the message you want to sign and applying a mathematical formula with your private key.
  • Anyone who knows your public key can mathematically verify that this signature was indeed created by the holder of the associated private key (but without knowing the private key itself). So, anyone can independently validate that this piece of data was signed by the private key holder of this public key.
  • Message + Private key -> Digital signature
  • Message + Digital signature + Public key -> Valid/Invalid
  • The mathematical process of ‘signing’ a message with a private key is actually an encryption process. You can encrypt data with a private key and decrypt it with a public key. So actually the validation process is taking the digital signature and decrypting it with the well-known public key, and seeing that the decrypted signature matches the message being signed.

Bitcoins

  • Objective of Bitcoin — to create an electronic payment system that cannot be censored, and to allow anyone the ability to send payments ‘directly from one party to another without going through a financial institution’.
  • Bitcoins are digital assets (‘coins’) whose ownership is recorded on an electronic ledger (Bitcoin’s blockchain) that is updated (almost) simultaneously on about 10,000 independently operated computers around the world that connect and gossip with each other.
  • Transactions that record transfer of ownership of those coins are created and validated according to a protocol — a list of rules that define how things work and which therefore govern updates to the ledger. The protocol is implemented by software — an app — that participants run on their computers.
  • The machines running the apps are called ‘nodes’ of the network. Each node independently validates all pending transactions wherever they arise, and updates its own record of the ledger with validated blocks of confirmed transactions.
  • Specialist nodes, called miners, bundle together valid transactions into blocks and distribute those blocks to nodes across the network. Anyone can buy bitcoins, own them, and send them to other people. Every Bitcoin transaction is recorded and shared publicly in plain text on Bitcoin’s blockchain.
  • The Bitcoin blockchain is managed by software running on computers that communicate with each other forming a network. Although multiple compatible software implementations exist, the most commonly used software is called ‘Bitcoin Core’ and source code to this software is published on GitHub.
  • Account creation — Use Public Keys as Account Numbers. Public/private keypairs also solve the authentication problem. You don’t have to log in to prove that you are the account holder.
  • Decentralized book keeping — anyone anywhere is able to be a bookkeeper without asking permission from anyone else and without hierarchy. In Bitcoin, any individual with a computer, adequate storage, and access to internet bandwidth can download some software (or write their own), connect to a few neighbours, and become a bookkeeper. New transactions are broadcast to all bookkeepers via a gossip network. Bookkeepers can now performs two functions: Validating and propagating ‘pending’ transactions Validating, storing, and propagating blocks of transactions. In Bitcoin, blocks are created every 10 minutes on average. Different cryptocurrencies have different block creation target times.

How Bitcoin Blockchain works

  • Transactions are payment instructions of specific amounts of Bitcoin (UTXOs) from one user-generated account (address) to another.
  • The transactions are created using wallet software, authenticated with unique digital signatures, then sent to bookkeepers (nodes) who individually validate them according to some well-known business and technical rules.
  • The bookkeepers then add valid transactions to their mempool and distribute them to other bookkeepers that they are connected to.
  • Miners gather these individual transactions into blocks and compete with each other to mine their blocks by tweaking the block contents, specifically the nonce field, until the hash of the block is smaller than some target number. Proof of Work / Mining.
  • Mining — Miners calculates a cryptographic hash from the block’s data. The rule of Bitcoin’s proof-of-work game of chance says, if the hash of the block is smaller than a target number, then this block is considered a valid block which all bookkeepers should accept. The solution in Bitcoin is that in every Bitcoin block there is a special part of the block that block-creators can populate with an arbitrary number. Its only purpose is to allow block-creators to fill it with a number, and change the number if the hash block doesn’t meet the ‘hash is smaller than a target number’ rule. So, if the first hash attempt doesn’t result in a winning hash, then they can just change the number in this part of the block. This number is called the ‘nonce’ (number once) and is completely separate from the financial transactions in the block. Its only job is to change the input data for the hash function. If the result meets the ‘hash is less than a target number’ rule for valid blocks, then they have created a valid block, and can send it to the bookkeepers, and get to work on the next block. If the result doesn’t fit the rule, then they change the nonce (e.g., by adding 1) and hash again. They do this repeatedly until they find a valid block.
  • Miners receive a financial incentive in the form of new BTC and transaction fees which they may credit themselves, to compensate for spending resources to perform the competitive, repetitive hashing needed to create valid blocks.
  • The blocks link to each other in a unique sequence to form a ledger, the Bitcoin blockchain, that is recorded identically almost simultaneously on thousands of computers around the world that run Bitcoin software. If a Bitcoin transaction is not recorded on this blockchain, it is not a Bitcoin transaction. It doesn’t exist. A Bitcoin transaction recorded outside this file does not form part of the ledger.
  • If a miner receives two valid but competing blocks, the rule is that the longest chain is the chain that should be considered the chain of record. longest chain rule .
  • There is no central authority who controls the ledger or who can censor specific transactions.

Bitcoin Ecosystem

Bitcoin in Practice

  • In Bitcoin, your chance of winning a block is proportional to how much hashing power you control. In the Bitcoin whitepaper this described as ‘one-CPU-one-vote’.
  • The maximum number of bitcoins created ever will be a sliver under 21 million, the last of which should be created a little before the year 2140.
  • The network needs to self-correct and slow down if blocks are created more quickly than the target of one block every ten minutes. The target number is based on the difficulty setting at the time, which is derived from the time taken to mine the previous set of blocks to achieve a network-wide target frequency of one new mined block every 10 minutes. The network is beautifully self-balancing. If more hashing or mining power is added, then blocks get created faster for a period of time until the next difficulty change, after which it becomes harder to find valid blocks, slowing block creation down.
  • While there are around 10,000 nodes who perform bookkeeping tasks and who relay transactions and blocks, they are mostly running the same software written, and therefore controlled, by a very small number of people. They are known as the ‘Bitcoin Core’ developers and the software is known as ‘Bitcoin Core’.
  • Although anyone can mine, the process has become so intensive that new hardware and chips are created which are designed to be exceedingly efficient at performing the SHA-256 hashing. ASICs (Application Specific Integrated Chips) became the norm for mining in 2014 and outcompete all other forms of hardware in terms of energy efficiency for Bitcoin mining. Only a few entities can mine profitably, usually using special purpose ‘mining farms’ clustered in areas of cheap electricity.
  • At an estimate, around 80% of the hash power is controlled by Chinese entities. BTC.com, Antpool, BTC.TOP, F2Pool, viaBTC are all Chinese groups107, and a company called Bitmain owns both BTC.com and Antpool. Hence, if only the top three mining pools collaborate, they can reorganise blocks and arrange double spends, and no one would be able to stop them as they represent more than 50% of the total hashing power.
  • Miners use special purpose chips called ASICs that are specifically designed and built to be efficient at SHA256 hashing. Commercial chip manufacturers have been slow to design chips that are specifically built to be efficient at SHA256 hashing, so demand has created an alternative specialised industry for supplying Bitcoin ASICs. The main provider of this is Bitmain, the same Chinese company who controls the top two mining pools. It has been estimated that Bitmain produces hardware that mines 70–80% of the total blocks in Bitcoin108. Bitcoin hardware manufacturing is not well decentralised.
  • According to an analysis, almost 90% of value is owned by fewer than 0.7% of the addresses.
  • Upgrades to the Bitcoin network and protocols are also fairly centralised. Changes are suggested in ‘Bitcoin Improvement Proposals’ (BIPs).
  • The total transaction fees have stayed stubbornly low at approximately 200 BTC per week. Without significant increase in transaction fees to compensate, clearly the economics of Bitcoin mining will change.

Ethereum

  • Ethereum has a public blockchain running on 15,000 computers158 and the token on the blockchain is called Ether (ETH), currently the second most popular cryptocurrency.
  • In contrast with Bitcoin, Ethereum transactions can contain more than just payment data, and the nodes in Ethereum are capable of validating and processing much more than simple payments.
  • On Ethereum, you can submit transactions that create smart contracts — small bits of general purpose logic that are stored on Ethereum’s blockchain on all of the Ethereum nodes. These smart contracts can be invoked by sending Ether to them.
  • Like Bitcoin, Ethereum has a blockchain, which contains blocks of data (Pure ETH payments as well as smart contracts).
  • On Ethereum’s roadmap there is a plan to move from electricity-expensive, proof-of-work mining, to a more energy-efficient, proof-of-stake mining protocol called Casper in a future release of the Ethereum software called Serenity. Proof-of-stake is a mining protocol in which your chance of creating a valid block is proportional to the number of coins (ETH) in your mining wallet — contrast this to proof-of-work, where your chance of creating a valid block is proportional to the amount of computational cycles your hardware can crunch through.
  • Vitalik Buterin, the creator of Ethereum is hugely influential, and his opinions count. Although he can’t stop his creation or censor transactions or participants, his vision and commentary have a big impact on the technology.

Digital Tokens

  • Tokens can be fungible (one token being more or less replaceable by another), or non-fungible (where each token represents something unique). Unlike cryptocurrencies, these newer tokens are usually issued by known issuers who stand behind them, and the tokens can represent legal agreements (like financial assets), physical assets (like gold), or future access to products and services.
  • Ownership of any cryptoasset, whether it is a cryptocurrency or a token, is vested in the person who has the private key that corresponds to the address with which the token is associated. This private key allows that person — the owner — to create and sign transactions releasing the token and assigning it to someone else. In some respects, cryptoassets are like bearer assets — if you hold the private key, it is yours.

Types of Token

  • Native blockchain tokens, which are essential for the underlying blockchain to work or be incentivised. Native tokens are usually the incentive for block-creators to do their work. Cryptocurrencies are usually native tokens. ETH is also used to pay Ethereum miners to run smart contracts. The tokens are also known as ‘intrinsic’ or ‘built-in’ tokens. They are inseparable from their blockchain systems, and are used both as an incentive for participants to keep the blockchains running, and as a payment mechanism to use the blockchains.
  • Asset backed tokens, which represent title or ownership to some real-world asset held in trust by a custodian.
  • Utility tokens, which represent a claim on a service provided by the issuer of the token.
  • Contract Tokens Contract tokens represent a contractual obligation between the issuer of the token and the bearer of the token, or between two parties who jointly agree to hold the token.

Blockchain Technology

  • Blockchain technologies are the rules or standards for how a ledger is created and maintained. Blockchains usually contain the following concepts:
  1. A data store (database) that records changes in the data.
  2. Replication of the data store across a number of systems in real time. ‘Broadcast’ blockchains, such as Bitcoin and Ethereum, ensure that all data is sent to all participants: everyone sees everything.
  3. ‘Peer-to-peer’ rather than client-server network architecture.
  4. Cryptographic methods such as digital signatures to prove ownership and authenticity, and hashes for references and sometimes to manage write-access.
  • Public, Permissionless Blockchains — anyone may create blocks or be a bookkeeper without needing permission from an authority. To date, public blockchains have been used with some success in the following areas: Speculation Darknet markets Cross border payments Initial Coin Offerings
  • Private Instances of Public Blockchains — earlier, you can run blockchain software on a private network to create a fresh ledger. but instead of pointing your node to some computers already running the public Ethereum blockchain, you could point it instead to a few other computers that are not on the public Ethereum network.
  • Permissioned (or permissionable) blockchains — Some platforms are designed to allow groups of participants to create their own blockchains in a private context. They do not have a global public network. These are called ‘private blockchains’ and they are designed to only allow pre-approved participants to participate. Ethereum, permissioned blockchains don’t need their own native token. They don’t need to incentivise block-creators, and they don’t need proof-of-work as the gating factor to allow participants to write to the shared ledger. Instead, when businesses transact, they are looking for data that can be trusted to be up to date, agreed and signed off by the appropriate parties. In a traditional business ecosystem, participants are all identified, and if some try to misbehave they can be sued.
  • Private blockchains aim to increase the quality and security of technology used in business-to-business communications. They allow unique digital assets to move freely and reliably between companies without the need to have a third party act as a record keeper. Private blockchains can provide transparent multilateral workflows in the form of smart contracts, and demonstrate that the agreed workflows are adhered to. This is what is meant by ‘trustless automation’. Instead of having to trust a business to perform as agreed, a smart contract ensures that pre-programmed processes are followed.
  • Notable Private Blockchains includes Axoni AxCore, R3 Corda, Digital Asset GSL, Hyperledger Fabric, JP Morgan Quorum. Blockchain use case.

--

--