Blockchain

Tuesday, October 18, 2016

Contributors: Sachin Kesiraju, Siddhanta Dange, Shirish Dhar, Brian Goodness

external image W2NyVX_iCm-wmVV--nRc4XaBdGuQ6i9_OERAEAB8JkcqzM4eFO9lW63Lzrmnpv_GR_sqA5PwOEZo8tnAgKqpIfT8Cn2wHO-eZKTHKC9UT0TUgIlKnof4WP89qvdF0QjrLCTa6kwk


The comic strip above effectively illustrates the common trend to loosely use the word ‘Blockchain’ without much understanding of the underlying concept.

To give us more insight into the theory behind the popular buzzword, we had Balaji Srinivasan, CEO of 21 join us in class.

So what really is the Blockchain?

It’s a new kind of database that serves as the data structure that underlies Bitcoin. The goal of the Blockchain is multifaceted, but, its main objective is to serve as a public ledger of all transactions-- whether it be financial or nonfinancial-- so that no one centralized party must be trusted but instead all participating parties regulate one another.

What is Bitcoin then?

Bitcoin is a form of digital currency that’s generated and held electronically. What makes bitcoin different from traditional currency is that it is decentralized i.e, no single governing body controls the bitcoin network. Instead, each machine that processes bitcoin makes up the network that validates other transactions from across the network in a way that the currency is actually self-regulating.

Bitcoin eliminates the friction of sending money while ensuring anonymity by identifying participants of a transaction by a unique bitcoin address. It takes a matter of seconds to set up a bitcoin address and requires no fees or frustrating trips to the bank. All transactions are transparent on the network but have no trace of your personal information. Bitcoin maintains consistent state across all parties by keeping a record of transactions that have occurred and thereby prevents double spending or loss of currency in the case of an outage.

More about Bitcoin



external image 9YreZiZG0S5sqHomtLu4EeaFVkzanQ_tGoWPNX-eNB-eiDl_QlUTpOoe4bINw-FdkHfKJrDxd53dhFo-w-TJxbK462PNt5MXrYB6QsAfHuO2GNsE-mQ0g1DDzLMCCAir5AY1hIs9


  • It is a way to represent scarcity on the Internet. On the Internet, most of the resources are not very scarce (e.g., computational power, bandwidth, etc) compared with traditional physical resources (e.g., cars, houses, etc.). In Economics, scarcity is an important concept because it is a key assumption under which the real-world operates. In other words, the technological ability to emulate scarcity in the virtual environment allows for the efficient allocation of real-world resources that can be transferred in a more frictionless manner.

  • There are four types of representations of scarcity on the Internet:
    • Physical Cash: A sends cash to B, of which A no longer has.
    • Naive Digital Cash: A sends serial numbers to B, but A still has a copy (i.e., not rivalrous).
    • Centralized Digital Cash: C is a bank (or other trusted financial intermediary), that is trusted to debit and credit the accounts for A and B.
    • Decentralized Digital Cash: all parties know about all transactions, including which accounts were debited and credit funds

  • Bitcoin is like the new Internet. In the early days of the Internet, connectivity to the network was centralized-- i.e., participants had to connect through a trusted central authority (e.g, AT&T). However, today, the process to connect to the Internet is more decentralized; anyone can programmatically send packets to anyone on the internet.

  • Bitcoin is open-sourced value transfer. Bitcoin is decentralized to ensure that no governing authority can intervene. The software is open source, which means that anyone can look at the underlying code to ensure it does what it’s supposed to. Think of bitcoin as similar to email, anyone can use it just by having their own unique identifier and knowing their receiver’s identifier (bitcoin address/email address).

  • Bitcoin is extensible. Since Bitcoin is open source, it gives the user full personal control by offering the ability to customize the platform by building their own modified versoin. As Balaji succinctly put it, think of Bitcoin is to Paypal, just like Linux is to Windows.

More about Blockchain



external image RFffM6yBhi3o8ylhWk1dxB_n80OjN0xl2EChkEVvHgFDNUUZnQuzlqIHH3EQOxRmG_e-prcAp7EVawDbgvWT59VGDthV18FCMBr4_-cEPOsC3pJ9Rg1BK1lvuplIK1Z7_FlpUDVB


  • It is based on distributed ledger technology open to anyone that stores a set of verified transactions.
  • It is a ‘database‘ that can only be updated with proof-of-work or proof-of-stake, or some other method of distributed consensus.
  • Avoids a centralized authority/regulatory body by using a peer-to-peer network to verify all transactions.
  • Robustly built for an adversarial environment. For instance, if you could cheat it, then large amounts of value could be stolen.
  • Blockchain.info: a useful online transparency tool (aka a “Block Explorer”) that allows you to see all transactions being logged onto the public blockchain in real time.
  • Blockchain ensures security by employing an encryption technique known as a cryptographic hash

Cryptographic Hash

  • A function with high entropy, in which it is impossible to deduce input from knowing the output
  • In typical mathematical functions, a small difference in the inputs corresponds to a small change in the output. In a cryptographic hash (e.g., SHA256), a small difference in the inputs corresponds to a large (or, undeterminable) change in the outputs.

The Bitcoin Blockchain



external image F1asO9vquzvSJcQbdSE04H5bxWndxBLYZJ7aQBpu04r-dYMilCb3GWiC5cTnh8_mObpqd1ecRi7HhczulKEDcQvno9FRRhOaH0Dsp49FWoI3YifwgRW_lRSQJhbbqeBAezzmcly6


  • Miners incorporate transactions into a block-- this does not have to be only financial transactions (e.g., Bitcoin), but can contain any type of transaction (e.g., execution of transactions based on smart contracts).

  • Public vs. Private Blockchains:
    • Public Blockchains
      • Initially, it is useful for speculation, then payments, then smart contracts ("contracts as code").
      • Speculation: Bitcoin doesn't require a lot of transactions over a period of time (used as a store of value).
      • Payments: send money from point A to B.
      • Smart Contracts: allows for N-players in which a flurry of bilateral contracts can lead to the rise of a new complex economy.
    • Private Blockchains
      • Useful for: control, security, privacy, anonymity, speed
      • Control: can restrict write privileges to a centralized authority and determine whether read privileges are extended to the public or kept private. If desired, one can pick and choose specific aspects to sync with the public blockchain.
      • Security: can keep blockchain maintained behind a “walled garden”
      • Privacy, anonymity: applications that mandate that privacy and anonymity are of utmost priority. Although transactions logged on the blockchain usually only show the addresses that invoked specific transactions and/or contracts, the blockchain is not completely anonymous. In other words, the blockchain is pseudonymous-- a person could be tied back to a specific transaction or set of transactions.
      • Speed: a private blockchain has fewer transactions and nodes than the global, public blockchain, reducing time needed to sync all nodes with the blockchain

  • The Bitcoin Blockchain has inspired innovation in several cases:
    • Interplanetary File System (IPFS): the ability to store data decentrally, without write restrictions.
    • Ethereum: like Bitcoin, but have more programmable control-- the ability to write arbitrary smart contracts.
    • ZCash: private blockchain (hides details of transaction on blockchain)
    • Machine payable web - using bitcoin as platform for micropayments (Eg: https://21.co)
  • Etherium & Smart Contracts
    • Traditionally in Bitcoin, each address (public key) has an associated balance, also known as the Unspent-Transaction-Output (UTXO)
      • the sum of the UTXO's in each public key belonging to a certain user is their total balance
      • fragmented, hard to remember
    • Accounts
      • solves the issue of fragmented balances
        • 1 public key address
      • includes balances
        • total balance for one account
      • Transactions are still stored on the blockchain and are publicly verifiable.
    • smart contracts
      • contract
        • written or spoken agreement
      • smart contract is code that facilitates certain behavior based on the inputs
        • Multi-Sig Ex. if 3 people send an amount that signifies 'yes', then a certain amount will be sent to another account
      • can store/maintain data
      • can facilitate negotiation or relationship
      • can act as a software library
  • Decentralized Apps
    • Using smart contracts, which is arbitrary code, we can write apps
      • even an organization/government (rules are written in code), organization management can all be automated through smart contracts
    • Ex: Crowdfunding
      • if a certain balance is met from transaction to a certain account, the project will be considered funded
      • if a deadline passes, everyone will receive their contribution back
    • Ex: Locks
      • If I have an Airbnb, I can install a lock that only opens if a certain balance is sent to an account. The smart contract will check if a certain balance has been met, and if it has, grand access to an account tied to the sender's public key
    • Ex: fully automated restaurants.
      • Using a smart contract, we can ensure full automation of a restaurant, publicly verifiable transaction, as well as streamline the payment process - any N friends can pitch in to pay for food. Anyone who wishes to exploit a better user experience would be a user for this decentralized app.
      • By nature of cryptocurrency, no fees for merchant to accept credit
      • By nature of cryptocurrency, no credit settling process - value is transferred instantly

What are the next steps?

  • Try it out for yourself!
    • To earn free Bitcoin (e.g., to use for coding), go to https://21.co/tasks/
    • The service will pay you micropayments for microtasks
    • Use Access code: BERKELEYOCT18
    • Note: in order to cash out earnings, will need a social network account (to deter bots)
  • The earned Bitcoins (or ether) can be exchanged for any other digital currency.
  • Go to Coinbase (https://www.coinbase.com/) and setup a wallet and allow you to sell it for dollars.
  • Use Shapeshift (https://shapeshift.io/) to convert your Bitcoin to any other cryptocurrency.
  • Try setting up a private blockchain! Look into Chain (http://chain.com/), Hyperledger, R3, and Monax.