How to Understand the Blockchain and Crypto-currency mining

Liga Hall
Coinmonks
Published in
7 min readApr 15, 2018

--

The Tetris metaphor: a simple explanation for crypto currency and mining

Tetris, an addictive puzzle matching game, incredibly popular since its release in 1984, is arguably universally understood. Who doesn’t know how to play Tetris? Who can’t hear that siren song jingle, enticing you into its technicolour, geometrically defined world?

For those of us who are not in the know, Tetris works like this:

Firstly, it is a computer game played in an arcade, on computers and phones everywhere, and perhaps even in your home right now. It is played on a grid, called the Matrix, which is 10 by 20 block units. Different shapes (Tetriminos) fall from the top of the screen, and come to rest at the bottom. As the game increases in difficulty, the shapes fall faster and faster. The aim of the game is to create a perfect, horizontal chain of ten block units. When a 10 block chain is created, the player receives a points reward, the chain disappears, and a new chain must be created. The blocks may also start falling faster, as the player improves in skill and the difficulty of the game increases. The game is over when the matrix is full of block stacks and no new shapes may descend.

Got that? Well congratulations, you can now play Tetris AND understand the concept of blockchain technology and mining. But how?

First, let’s take a look at a game of Tetris.

Source: wikipedia

Now let’s deconstruct and define the components of Tetris and their functions:

Tetris matrix: The size of the game, generally 10 by 20 block units. Once the Matrix is full, the game is over.

Tetriminonos: Different geometric blocks that descend from the top of the matrix, and fall to the bottom. These form the blocks in the horizontal chains, and also take up space in the matrix.

Horizontal chain: A line of blocks, without gaps, that covers the width of the matrix (so a 10 block matrix would have 10 blocks in its horizontal chain.) The creation of a perfect horizontal chain results in rewards for the player.

Difficulty adjustment: The changes that the game makes to increase its difficulty over time — so making the blocks fall faster as you progress through levels ensure that, as you improve at the game, it still takes you a particular amount of time to complete each level.

Aim/Proof of work: To figure out how to position each shape so that it fits neatly into a gap in the horizontal chain. To create matrix wide (so 10 block) chains of horizontal blocks. This is largely governed by the player’s brain power — how quickly they can figure out where the block fits — the answer to the question ‘which way does this block have to go for it to fit in the chain?’. The answer/aim/proof of work means that the block fits into the chain, and the game continues.

Outcome: The successful answer (so the block fitting neatly into the chain) wins points or keeps the game alive. The blocks build to create a horizontal chain, the player receives a reward.

So how does this relate to the blockchain?

‘The blockchain’ is a fairly broad term given to a particular kind of technology that essentially performs the same action as an accountant, or a household budget — it’s a system that keeps a ledger of transactions. Cryptocurrencies, like Bitcoin, Ethereum and Dogecoin, are digital coins (so digital money) that can be sent between different people, using the blockchain technology to check that the transaction is correct, and to enable the transaction to occur. You buy cryptocurrencies from exchanges, just like Fiat (hard currency, the Australian dollar, the Yuan etc,) currencies, and there are a range of trading pairs to choose from. This is like trading on the stock market, where these digital currencies are stored in a digital wallet online, or on a device. But wait, you say, isn’t that basically meaningless? Isn’t that just imaginary money?

Well, the good news is that you’re right, crypto currency IS imaginary money! But, the bad news is that all money is ‘imaginary money,’ in that it HAS no objective value. I mean sure, with enough money I could perhaps papier-mache myself a house, but you can’t eat it and you can’t live in it and it doesn’t really mean anything unless we all agree it does. And we can make decisions about what currencies we support, and which ones we don’t.

Cryptocurrencies give us that freedom. The beauty of crypto is that instead of value being attributed to a centralised resource (such as oil or gold,) that is regulated against a state’s economy (The US….we’ll talk more about this later,) it can be produced and controlled by any individual person with an internet connection and a properly programmed computer. Anyone can own the machines that mine crypto-currency, and so they cannot be (completely) controlled by the state — whichever state that is. It can be controlled by individuals, and mined for individuals.

Okay, so back to the blockchain. Let’s look at a transaction — so Bobby buys a tattoo off Billy for 0.003 dogecoin — and these go into the blockchain. The blockchain is secured by a network of computers called miners. The miners have two jobs. Firstly, they must verify that the transactions are valid (so confirming that Bobby actually has 0.003 dogecoins to spend, and then that Billy is the one receiving them.) They do this by creating what is called a proof of work. This is, essentially, an answer to a very complex algorithm (a maths problem.) But, they must do it more than once. They do it thousands and thousands of times. All the miners compete with each other to see who can get this proof of work ready first — this is dependent on the strength of your internet speed; how quickly can your miner, or group of miners (a mining pool,) solve the problem the set amount of times it needs to generate the proof of work? The first miner, or mining pool, to generate this proof of work ‘wins’ the block and is rewarded with a coin payout.

A block is made up of a certain number of these blocks of verified transactions with proof of work — this is all uploaded to a ledger that everyone can see. This is where the second job of the miners comes in — to generate coins in the blockchain. Every time a network of miners generates a block, more coins are discovered. This is where difficulty adjustment comes in. Each time a certain number of blocks is created — good coins check every time a single block has been made, erm…less good coins check at the end of each 2016 block chain — the blockchain system checks to see how long it took the miners to make the block of data, and solve the proof of work problems.

The blockchain, before the mining began, made a guess about how long it would take to discover or mine all of the available coins — so how hard it will be to solve all of the algorithms, and how long it should take to do it. Once all of the coins have been mined, more currency must be generated. Each difficulty adjustment period, the Blockchain compares the time of its estimate, to the actual speed of the miners. The blockchain then changes how difficult the algorithms are to solve based on how quickly the miners create the chains. Over time, the computers get better at solving the problems, and so the blockchain increases the difficulty level so that it will still take the same amount of time as estimated to assemble the chain and mine the coins.

Are you still with me? How does this relate to Tetris now please?

Have a look at the below image:

The Tetris explanation of blockchain: components and functions.

Tetris matrix: The amount of coins available to mine

Tetriminonos: Blocks of data (so transactions waiting to be verified,) and proofs of work (so a certain number of answers to a question, a certain amount of times.)

Horizontal chain: The block chain. Chains of data blocks that verify data, produce cryptocurrency and manipulate the difficulty of the problems.

Difficulty adjustment: The changes that the block chain makes to increase its difficulty over time — so making the problems harder to ensure that, even as the computers get better, it takes the estimated amount of time to mine all the coins — to fill the matrix with chains and ‘end’ the game (so you either level up — more crypto currency is added to the market, or the game is over.)

Aim/Proof of work: For your miner to create the proof of work first, and ‘win’ the block (so figure out how to slot the block perfectly into the horizontal chain.)

Outcome: The winning miner gets a coin payout reward.

So basically, in Tetris, just as with Crypto mining, you get points for correctly solving a problem and by creating a chain of blocks. Except imagine that ‘you’ are a computer, or group of computers, called ‘miners.’ You have to figure out how to solve the problem (so create the proof of work,) to fit the block into a gap in the chain. You have a certain amount of time to do this, determined by the speed at which the block falls (how difficult the game is.) You have to figure out how to slot the block into its space in the chain before the block reaches the bottom of the matrix and touches the other chains. This is where your computer/miner/mining pool is competing with the others to see who can generate the proof of work (so the correct number of answers the correct number of times,) first, and therefore win the prize (a coin reward) or keep the game of Tetris going. The idea is that with more levels, so the addition of more currency and more miners, the game becomes more difficult but the rewards (so coin payouts) remain fairly stable. And that is basically it!

I hope that this has been a useful metaphor for you. Conceptualising it helped me understand the fundamentals of mining, so I thought I would share…

--

--