As Fast As Possible — Blockchain

By Eren Suner on ALTCOIN MAGAZINE

Eren Suner
Nov 1 · 4 min read

The sole purpose of this is to teach you blockchain as fast as possible, at whatever depth you need.

Conventions I use: (always bold and italicized)

  • H: Higher view. Analogy.
  • M: Medium view. Actual stuff.
  • L: Lower view. Technical details.
  1. Anatomy of a Block
  2. Blockchain & properties
  3. Do you need a blockchain? (Weighing ideas)

Anatomy Of A Block

H: It’s like a balloon that changes color based on the gas inside it.

Miners are the people who tweak the gases to make the color look good.

The gas inside includes a special gas that is the same color as the previous balloon.

M: Color is the hash (a function of data, play with it here).

Nonce is just a number used to adjust the hash.

The gas is everything inside a block (nonce, data and previous block’s hash).

The nonce is what miners change to get a set number of zeros at the front of the hash. If a block’s hash doesn’t have a set number of zeros at the front of its hash, it’s considered invalid.

Genesis block: the first block in a blockchain, prev hash is 0 or doesn’t exist.

L: A hash function has the following properties:

  • Same input always yields the same output (f(A) = B). No random stuff happening.
  • Infeasible to reverse a hash. (No way to get from color to gas)
  • Even a small change in input changes the output completely.

Different blockchains have different block implementations. For example, Bitcoin’s block implementation is different than Ethereum.

Blockchain

Blocks are in a linked list structure. The special gas points to the balloon before it. As you’ll see this has some implications. A blockchain is a distributed ledger, which is like a database that’s shared among everybody in the network.

Blockchains come in three flavors:

  • public — like bitcoin, ethereum, etc. Everybody is allowed to join and information is public. (low trust environment)
  • consortium — need permission to join. Still, low trust and data are shared with all the nodes.
  • private — centralized authority, permissioned, high trust

Properties Of A Blockchain

H: Everbody has a copy of the chain of balloons that are exactly the same. When somebody changes/adds a balloon, everybody’s balloon chain updates.

If some people decide to not update their balloons to others this is called a fork. Avoid this at all costs.

M: Blockchain is designed to be not reliant on a single central authority. Whenever a block is added to the blockchain or a transaction is added to the mempool (where transactions go before going into a block) they are broadcasted to the whole network (or only the nodes involved).

H: When somebody changes the gas inside a balloon, it’s color changes, this results in the next balloon’s gas being changed because of the special gas. This chain continues until the most recently added balloon.

M: Play with it here.

L: Read the analogy again. When you change the data in a block, it invalidates all the blocks that come after it. This is because even if you mine that one block, it’s hash changes. Since the previous hash is included in the next block, you have to mine that again and it’s hash changes as well. The bottom line is: you create a chain reaction.

You’d have to have the majority of the computational power (if the consensus method is proof of work) in the network to mutate the blockchain, as nodes trust the longer blockchain. The blockchain which has the most computational power is the faster developing one, so it will be longer at the end.

The bottom line is if you can add more blocks to the chain than the rest of the network, that blockchain will no longer be immutable.

Do You Need A Blockchain?

This is purely the work of Consensys. For more information, take their Coursera course, “Blockchain: Foundations and Use Cases.”

Use blockchain if you need all of these four things:

  • A database
  • There are multiple writers
  • Writers are untrusted or have conflicting interests
  • Cannot rely on trusted 3rd party

Key Takeaways

  • A blockchain is a distributed database.
  • Blockchains are immutable unless you can generate more blocks than the rest of the network in a given amount of time.
  • Blocks include data, a nonce, and the previous block’s hash.
  • You only need blockchains under certain conditions, don’t try to use them for everything.

Hey! I’m Eren, a 15-year-old innovator, and blockchain enthusiast. I’m participating in a human accelerator called TKS. Check out my website! (any feedback is welcome) here. I’m currently working on a modular bitcoin replication called tadcoin.


ALTCOIN MAGAZINE

The best damn place to read and write about crypto and blockchain.

Eren Suner

Written by

Hey! I’m Eren, a 15-year-old passionate about Blockchain. I also like writing about my learnings.

ALTCOIN MAGAZINE

The best damn place to read and write about crypto and blockchain.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade