Sunday, April 8, 2018

Jiaying tries to explain the blockchain

What is blockchain and what does it promise?


From what I understand, a blockchain is a database that is stored on a distributed network. Changes in the database, which can also be called transactions, are stored on the blockchain as blocks, which are linked up in chronological order (like a chain) creating a timeline. By going back in a blockchain you would be able to look at all of the changes/transactions that happened during the history of the blockchain. You can only add new blocks, you can not change previous blocks.
Analogy: It’s kinda like the version history on google spreadsheets, you’re able to see all of the changes that have occured since you’ve created the document, and multiple people are able to add their changes
A blockchain is not meant to be stored on a single centralized server, if you want to participate in editing the database, you will need to download a copy of the blockchain and serve as a node in the network. Nodes in a blockchain network talk to each other in order to verify that everyone’s copy of the blockchain is the same (and not tampered with) and notify each other of new blocks that have been added to the blockchain. This system allows every participant in the blockchain to know that the previous blocks are not being edited. Every node gets to send transactions to every other node without having to go through a central entity.
A simplified node diagram
Analogy: I need to pay my rent ($1000), I have an account with bank A, my landlord has an account with bank B. Bank A needs to debit my account $1000, send this money to bank B, and bank B will then have to credit my landlord $1000. This relies on all of us trusting that at each stage of the transaction no one is fucking the other person over (because we’re not trucking $1000 dollar bills from bank A to bank B). If I was paying my landlord using cryptocurrency like bitcoin, I would just send my rent to them from my node to theirs, and as the transaction is being sent across the network, every node would verify with their blockchain that nothing fishy is going on.
Me before you (blockchain)
The use of blockchain promises:
Security - The anatomy of a blockchain makes it difficult to edit previous blocks without invalidating all subsequent blocks, this prevents hackers from changing the data. Because all other nodes are cross checking with each other’s copy of the blockchain, edited blockchains will also be rejected by other nodes as fraudulent.
Privacy - The data on all blocks are encrypted, which anonymizes who’s sending what to who.
Decentralization - Because the data is not stored on a central server somewhere, no central institution has control over the database (unless of course they own all the nodes on the blockchain)
Trust - Which becomes unnecessary since the blockchain algorithm will make sure that no one is making fake transactions (ie. paying someone money that we don’t have).
Reduction of Bureaucracy - It simplifies transactions and can reduce costs by cutting out the intermediary infrastructure needed to support peer to peer transactions.

Anatomy of a blockchain and how it works

A blockchain consists of blocks. These blocks are linked together chronologically.
Each block has:
Transactions - Theses are the changes to the database
Hash - This is a fingerprint uniquely identifying the block and it’s contents
The previous block’s hash - This is what chains one block to another
This is what a simple blockchain would look like:
The hash of each block is basically the encrypted information on the block. To generate a hash you would feed, the transactions and the previous block’s hash into a hashing function, which would then spit out a unique hash.I’m depicting it as a pictorial fingerprint, but a real hash would look something like this:
28902a23a194dee94141d1b70102accd85fc2c1ead0901ba0e41ade90d38a08e
This hashing function is deterministic, which means that editing any of the input would change the output hash.
If you edit a transaction in a block, it will change it’s hash.Because blocks are linked to each other by their hashes, changing one block’s hash will change all the subsequent blocks’ hashes as well. Your blockchain is now completely different from any other node’s blockchain, which will result in them rejecting your changes.
Blockchain 1: “Why won’t you accept me? D’:”
Blockchain 2: “Because we come from two different hashgrounds”

So why’s people so hyped on bitcoin? Cryptocurrency and mining

So...honestly I feel like most people hyped on cryptocurrency don’t really know or care for its benefits (for list of benefits read section “what is blockchain and what does it promise”). Many people are just hodling onto the cryptocurrency waiting for it double and triple its price before selling it for the mad cash.
The reason why I feel it hasn’t swept the world by storm (or at least the bubble in which I live in) is that it doesn’t really address most people's needs. I trust my financial institutions not to fuck me over (maybe naively you might say), the places I shop don’t take bitcoin, and it’s too volatile as a currency.
Maybe cryptocurrency will take hold in places where the government and institutions can’t be trusted, but I don’t know.
Anyway, one part about bitcoin I never understood was
What the hell are these miners and what are they mining?
So one feature of bitcoin is that it has these bitcoin miners. Bitcoin miners are nodes that verify transactions and add them to a block, these blocks get added to the blockchain once that block is verified by other nodes. As a reward for verifying transactions and adding a new block, miners are rewarded with new bitcoins increasing the whole bitcoin economy. Right now miners get a reward of 12.5 bitcoins (which is approximately $150,000).
Because bitcoin is a currency, you can’t just flood the market with a ton of new bitcoins. That would screw up the value of each individual bitcoin. Which is why bitcoin’s algorithm only allows one new block to be added every ~10 min.
There are tons of these miner nodes competing to create the next block (and earn bitcoins), so how is only one created every 10 minutes? The algorithm does this by adding a layer of artificial difficulty by only accepting blocks with hashes that fit a certain requirement (ie. a hash that starts with n number of zeros)
000000cdccf49f13f5c3f14a2c12a56ae60e900c5e65bfe1cc24f038f0668a6c
In addition to the base hashing function inputs (transactions & previous block’s hash), miners also put in a third input, a number (which basically functions as a guess), which will hopefully generate a hash that fit’s the algorithm’s requirement.
These miners repeat this process 1,000,000,000,000,...s of times to find an acceptable hash
You need really powerful computers in order to mine bitcoins because it’s so astronomically impossible to find an acceptable hash. These computers also are super resource hungry. Currently bitcoin miners use as much electricity as the country of Algeria does in a year. Which is definitely bad for for the environment.
Eventually this energy consumption should decrease (or so people say) since the end total number of bitcoins in circulation will be capped around 21 million. Miners will be getting less and less bitcoin reward for each successful block, which will decrease incentive, decrease competition, and the algorithm will adjust the hash requirement to be simpler (less zeros).
But yes for now verifying bitcoin transactions are actually a lot slower than verifying credit card transaction. And it’s also destroying the environment with its carbon footprint.
What is a coin vs. token?
So one thing that was super confusing for me was what’s the difference between a coin verses a token. Quick googling seems to indicate that coins’ primary purpose is to work as currency, while tokens are a more generic counter system.

So why would you want to use blockchain?

So I get the appeal of blockchain for the anarchist type person (screw central powers of authority), but decentralization itself can’t really be a driver for big corporations to want to use blockchain right?
Well it does seem like there are several other benefits of blockchain for businesses.
  1. Prevent hackers and security breaches
  2. Make record keeping more automated (and reducing
But what I don’t get is how exactly do blockchain companies make money, if people are making peer to peer transactions, and skipping out on paying the middleman. The incentive to create a platform/software that facilitates direct transactions would have to come out of the goodness of their hearts right? What exactly is the blockchain business model if you employ the fundamental basics of the blockchain’s benefits?

Non crypto-currency examples of blockchain applications:

I was going to compile a list of non cryptocurrency examples with long explanations, but I figured other people have done a good enough job:

1 comment:

  1. Jiaying, great blarg post!

    Blockchain businesses build applications on top of the particular Blockchain protocol, and those apps charge for their services.

    Blockchain protocols seem to be mostly open source.

    Each block is verified by miners who get a portion of that blocks value when they verify it. I am not sure exactly how the verification incentive works for a Blockchain to manage a supply chain. (I’m learning about this too. IBM has a course on Coursera. IBM and Maersk partnered to build one of these supply chain Blockchains) I suppose IBM could do all the transaction verification and change other companies like Maersk whose supply chains they manage.

    Then the ledger is kept on each individual node, so I don’t think the maintainace of this requires additional cerntralized cost.

    So in short, apps make money the same as any other apps, the protocol is open source, the verification of each block is funded through a fee to the verifier, and the ledger is distributed so no central servers are required.

    However, everything I just said could be wrong. These are my working assumptions after only 3 lectures into Princeton’s Blockchain course :)

    Please let me know what errors you spot in my logic ( I say “what” not “if” because I am sure there are several haha)

    Either way, it was cool to read your post!

    ReplyDelete