The blockchain, from a git perspective.

The blockchain is a revolution idea that’s changed the way computation and transaction will be done for decades to come.  There is already plenty of information out there on this topic, so I’ll spare the internet yet another tutorial.  However, I do think I have an interesting perspective to bring to the discussion.  I often tend to view the blockchain as very similar to the wildly popular version control software git.  In this post I’ll be both teaching, as well as defending my unique position.

git

If you’ve spent even a small amount of time in tech you’ve heard of git.  git is decentralized source control, and has revolutionized the way software developers collaborate on projects.  The idea behind git, is essentially a linked-list where each commit is a new node in the linked list pointing back to a previous snapshot of the code.  What’s interesting about git, is you can have forks in your linked-list, and these can be merged or deleted (or, orphaned, in blockchain parlance) at will.capture_stepup1_5_6

In a sense, git is a controllable linked list history of your project (note, that this can be any project, not just software, even artists should use git).

The Blockchain

Now, let’s talk about the blockchain.  The blockchain, is like git, except inside of the linked-list’s nodes lie transactions, rather than code changes.  That’s all bitcoin is, a big long string of git commits with balances of addresses in the commits rather than code changes.  So what is the big deal?

When you’re using git, you don’t really care what a developer does if they fork your code and make changes to it, as long as you get to decide what gets merged back into your original code beforehand.  The same can’t be said of financial transactions. You do care if someone makes changes to that history.  For example, let’s say I was able to fork the bitcoin blockchain, and everyone had to follow whatever changes I made.  Well of course, I’d create a transaction between my address and satoshi’s claiming a few hundred bitcoin.  Then I’d merge it back into the master branch.  Sound good? of course not.  This is the ingenious part of bitcoin.

Mining the blockchain

Because we don’t want people to have the ability to alter the history or future of the blockchain, we need a way of achieving what’s called consensus.  From a git perspective, consensus is simply the maintainer of the repo.  Great, who do we trust to maintain the bitcoin blockchain? satoshi, maybe? how about no one.  How about we place our trust in mathematics.

blockchain

(here is our block chain, look familiar? it’s a git history, but with miners added on the last “commit”)

The way consensus is achieved without a centralized power having any control, is hundreds of thousands of computers around the globe (more computing power than google, in fact) are competing to cryptographically secure the bitcoin blockchain by solving hash puzzles.  The nature of the puzzles is that it’s nearly impossible for the same computer to mine two consecutive blocks.  This enforces decentralization mathematically.  These computers are called “miners” and whenever they find the solution to one of these puzzles, they get to “mine” a block (or commit, from the git perspective) on the blockchain.  But what’s in it for them? Each of the blocks contain a transaction that allows the miner to pay itself a certain amount of bitcoin, this is called the block reward.  Users of bitcoin also must pay transaction fees to move bitcoin from one address to another, the miner of a block also gets to collect these fees.

Forking

Like git, the blockchain can also be forked.  We saw it happen recently, when the blockchain split into the bitcoin cash branch, and the bitcoin branch.  In this case the fork was planned a head of time due to politics, however you’ll often hear the phrase “51% attack”.  This is a security concern for blockchain developers, that they always keep in mind when designing new blockchains.

Revisiting our initial question of “who do we trust to maintain our repo?”.  What would happen if someone managed to get enough computing power together to guarantee that they could mine every block? (note, for simplicity, let’s just leave it at that, but it doesn’t actually have to be every block)  They would position themselves as the “maintainer” of that blockchain.  They could decide what does and does not get added to our master branch of transactions.  This is obviously dangerous.  Luckily, as I said before, the amount of computational power that currently exists in the bitcoin blockchain is more than google has.  In effect, an attacker would have to manage to get their hands more computing power than google.  Attacks like this must still be considered with new non proof of work consensus algorithms that teams are currently developing though.

That’s all for now.  This style of blockchain is called a Proof of Work blockchain.  This means that a miner has proved that they’ve spent enough computation power to solve a hashing puzzle.  They’re proved their work.  There are other styles of blockchain that we’ll explore in future posts.  One is called Proof of Stake, whereby users of the blockchain stake their cryptocurrency in place of  computational power to “bet” on the probability of the next block and are rewarded for correct answers.  Another brand new one is called tangle whereby a user of the “blockchain” (in tangle’s case it’s actually a direct acyclic graph) validates other blocks in place of their transaction fee, thus trading a small amount of hash power in place of a transaction fee.

 

Advertisements

3 thoughts on “The blockchain, from a git perspective.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s