How do Blockchains, Bitcoin and Related Decentralization Technologies Work?

in #decentralization8 years ago (edited)

(x-posted from avyenterprises.com)

Ever since I began building my presence in the decentralization industry I've found myself giving many an impromptu Bitcoin 101 lecture - usually about two or three questions into the Pandora's Box that is "So, what do you do?"


<3 Charles Shultz

While I do enjoy bouncing my explanations off of various friends and colleagues; honing my pitch and presentation with each delivery, I can't help but think it might be a little easier for everyone involved if I wrote it all out like I were answering a question on r/explainlikeimfive that I could reference and refer to.

That is what I intend to do here. We'll see how that goes. You be the judge!

WTF is a Bitcoin?

Whoa, hold on there pal. Bitcoin - with a capital 'B' - is the peer-to-peer network that allows the transacting of bitcoin(s) (little 'b'). Thus a bitcoin is simply a unit representing the transfer of value within the Bitcoin ecosystem.

To better understand just what a bitcoin is and how it is able to traverse the Bitcoin Network we will ultimately follow one all the way from its creation to whomever 'mined' it to an exchange or perhaps even your own wallet.

First we need to get a few basics out of the way so please bear with me...


I'll try not to fall too far into the weeds, I promise!
via Media Marathoning

The Network

Bitcoin (capital B, aka 'the network') is essentially comprised of tens or hundreds of thousands of computers worldwide running a copy of the Bitcoin Core software or another compatible program.

Each installation is called a node and each full node is tasked with maintaining a copy of the blockchain while accepting and propagating new transactions and blocks from/to the rest of the network.

Blocks? Like Legos?

Yeah... kindof. In order for transactions to be confirmed as valid by the network they need to be included in a block that is built upon the chain of previous blocks that came before it.

Hence: 'blockchain'.

"But how are transactions put into blocks" you ask? Great question!

Some of the nodes on the network participate in a process called mining through which they collect the stray transactions relayed to them by other nodes and build them into blocks which are then broadcast back out to the network.

Mining Difficulties

Each block is subject to a number of rules governed by the network and the software that underlies it all. Most controversial for Bitcoin as of recent is the 1 megabyte size limit miners must work within, cramming as many transactions as possible into each block to maximize the collection of transaction fees. Alternatively some miners choose to produce empty blocks to decrease latency in producing/transmitting blocks.

The other major factor built into the system is the network difficulty which governs how often blocks are 'found' and added to the chain. Difficulty is adjusted every 2016 blocks to target a spacing of 10 minutes between each block based upon the average inter-block-time of the previous 2016 blocks.

This functions to keep the network running at a steady pace despite computing power being added to or removed from the network and underpins what is known as the Proof of Work method for securing our blockchain.

Imagination Time!


We're off to Imagination Land! - via South Park

Let's pretend we are a piece of mining software. At any given moment our job is to put together a collection of unconfirmed transactions, the header from the previous block on the blockchain and a random value called a nonce. Together with a few other bits and pieces this is our block-candidate.

Below is an approximation of our block in pseudo-code. This may not accurately represent how the data is actually structured but should serve to help illustrate what's going on.

Nonce
Previous Block Header
Transaction A
Transaction B
...
Transaction N

We then take this block of data and put it through a cryptographic hashing algorithm - in Bitcoin's case we use a variation on SHA256d - which reduces it all down to a string of hexadecimal characters that we will include in our block's header.

0000000000000000030a686697841075284e815db663943d9939c99aa0b90ca6

This example is an IRL Bitcoin block's hash, the top block when I copy/pasted it here actually.

Notice the string of 0's at the beginning. Those in the computer science field will instinctively understand that each of those 0's corresponds to a longer sequence of four 'off bits' (0's) when the number is denoted in binary rather than hexadecimal.

Network difficulty governs how many of these leading zeros must exist in the beginning of our block's binary hash before it will even be considered for acceptance by the network.

Because the hash function maps to this space of numbers in a statistically unbiased way we can know the probability of generating a hash that meets the difficulty criterion and thus how many hashes we will need to generate on average in order to find one that does.

This is where the nonce comes in. If we just rehash the same data then the resulting output will not change, so rather than rearrange the contents of our block we'll simply change (increment, typically) the nonce we're using after each failure and check to see if that results in a valid hash.

If it does we send that puppy out to the network to be confirmed so we can collect our reward!

Money From Nothing

I can already hear you saying "that's all fine and dandy, AvY but all we really care about is the money. Show us the money already, dammit!"

Fair enough. For all of this work we've put in I agree that we deserve some kind of compensation for securing everyone's transactions.

Luckily so does the network!

As a reward for doing all of this as a miner we are allowed to include one extra transaction known as the coinbase transaction in each block we mine which effectively creates coins out of thin air and transfers them into our wallet.

When Bitcoin was brand new circa January 2009 this reward started at 50 bitcoins per block and roughly every four years the block-reward is cut in half in an event that has come to be known as The Halving or Halvening. This dispersion schedule ensures that the total supply of bitcoins will never exceed 21 million.

And so our journey begins....

As a freshly minted - or mined - bitcoin we find ourselves assigned to whichever Bitcoin address was specified as the destination or 'output' in the aforementioned coinbase transaction. We don't actually exist anywhere, we are just referred to by this transaction verifying the validity of our ownership on the blockchain.

Before we can go any further we'll need cover some more theory to explain addresses, public/private keys and just how transactions are constructed/signed using cryptography.

Stay tuned for part two where we'll continue our blockchain adventure!

To be notified whenever a new post goes live and increase bloodflow to your genitalia* please be sure to like and follow AvY Enterprises on facebook.

*This statement has not been evaluated by the United States FDA. Please don't sue me!

Sort:  

Congratulations @avy! You have received a personal award!

Happy Birthday - 1 Year on Steemit Happy Birthday - 1 Year on Steemit
Click on the badge to view your own Board of Honor on SteemitBoard.

For more information about this award, click here

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations @avy! You have completed the following achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Round of 16 - Day 4


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @avy! You have received a personal award!

2 Years on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:

SteemitBoard Ranking update - Resteem and Resteemed added

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @avy! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 3 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

SteemFest⁴ commemorative badge refactored
Vote for @Steemitboard as a witness to get one more award and increased upvotes!