Decoding the enigma of Bitcoin Mining — Part I : Mechanism

5 stars based on 64 reviews

In this post we will try to break down, in simpler terms, the mechanism of blockchain and bitcoin. Readers are assumed to be familiar with a few basic cryptography and blockchain related terms. Today, I'll specifically focus on transaction validation and mining rewards. Transactions are validated by miners by solving complicated math puzzle and the first miner to solve this puzzle is rewarded with brand new coins aka virgin coins. This creation of new coins is somewhat equivalent to printing paper money by a government, or as economists put it, quantitative easing.

A government can print money at will resulting in inflation and currency's devaluation. But creation of money in bitcoin economy is pre-defined in such a way that the total supply approaches to 21 million After that no coins will be created. It's not possible to manipulate supply and hence price. In the below figure, the green line indicates BTC supply over time. Divisibility, portability, fungibility, scarcity, resistance to manipulation of supply and distributed authority, among others, make bitcoin a superior form of currency to government issued paper or digital money.

Now, how is money created in bitcoin economy? The most common answer I get is that miners are rewarded with coins they add a new block to the bitcoin blockchain by solving a math puzzle. What do we exactly mean by that math puzzle? We'll see by the end of this post. To find the answer in less technical terms, I particularly consulted these resources:. I would recommend Antonopoulos' book to anyone aspiring to learn about technical nitty gritty of bitcoin.

And the following is a great video lecture series taught by Princeton professor and PhDs. It consists of 12 sessions combined duration: We'll briefly discuss point 2 blockchain and 3 mining to answer our question regarding bitcoin creation. The below image illustrates the bitcoin peer-to-peer network and connected participants, a transaction issued and relayed by a bitcoin user with his private key and validation of that transaction by miners. The extended bitcoin network showing various node types, gateways, and protocols Image credit: Currently a block consists of around transaction.

Now let's see how miners validate the transactions. In other words, miners check if the issuer is the rightful owner holder of private key of coins to associated bitcoin address.

A miner verifies all such transactions and includes in a block. If the miner can add this block to existing blocks, known as the blockchain, it is rewarded for the computation it did. Now, the transaction must be transmitted to the bitcoin network where it will become part of the distributed ledger the blockchain.

We now elaborate hashing in sketchy terms. As of now, the hash of latest block in the blockchain, Block is: This difficulty level changes based on how much time, on average, is required to find a block. As the network combined mining capacity increases, difficulty too increases and vice versa.

The below figure illustrates block formation:. Now miner creates a transaction root aka Merkle root which essentially is hash of all transaction combined.

The process is illustrated below:. Block 's Merkle root is:. Suppose that we'd like to find the next block Block So we take hash of Blocktransaction root of all the transactions waiting to be included in Blocktimestamp we'll ignore in illustration. We have scroll right to see entire line:. Run it through SA, and see if it meets difficulty requirement, i.

Try 2, 3, 4, and so on until you find a number that satisfies the difficulty condition. I'm not how computers miners approach this random number guessing. This random number in Block is and was found by F2Pool. This nonce is not unique, i. The block is added to the blockchain and miner is awarded with I found this post very helpful since cryptocurrency and bitcoin are the newest to my dictionary.

I studied a bit about the technology and sort of summarized what I found useful. What math puzzle do miners actually solve? To find the answer in less technical terms, I particularly consulted these resources: Unlocking Digital Cryptocurrencies by bitcoin guru Andreas M.

Antonopoulos bitcoin wiki StackExchange bitcoin site I would recommend Antonopoulos' book to anyone aspiring to learn about technical nitty gritty of bitcoin. An individual will ask these two basic questions to justify a currency' value: Can I trust the money is authentic and not counterfeit? Can I be sure that no one else can claim that this money belongs to them and not me? In order to maintain integrity and prevent double spending, bitcoin implements consisting of: A decentralized peer-to-peer network the bitcoin protocol A public transaction ledger the blockchain A decentralized mathematical and deterministic currency issuance distributed mining A decentralized transaction verification system transaction script We'll briefly discuss point 2 blockchain and 3 mining to answer our question regarding bitcoin creation.

Bitcoin overview The below image illustrates the bitcoin peer-to-peer network and connected participants, a transaction issued and relayed by a bitcoin user with his private key and validation of that transaction by miners. Mastering Bitcoin Below is an extended illustration of connected participants in bitcoin network: The SHA algorithm is intended to take an arbitrary amount of input data and produce bits of output, whilst also maintaining certain properties that make for an effective cryptographic hash.

Miners try to "guess" the nonce; only way a miner can find the number is by brute-forcing, i. The below figure illustrates block formation: Mastering Bitcoin We now take a look at hashes of pending transactions: The process is illustrated below: Wikipedia Block 's Merkle root is: We have scroll right to see entire line: Guessing the number is solving the complicated math problem This nonce is not unique, i.

Authors get paid when people like you upvote their post. Nice Article I like reading it.

Sharpie pen style liquid markers where to buy

  • Buy dumps with bitcoin

    Mining bitcoin vs litecoin

  • De2bi bitstamp

    Hillcrest st johns road exmouth market

How i make $100 a day with hashflare bitcoin cloud mining tutorial review roi reinvest withdraw

  • Bitcoin block notify definition

    Advertising network bitcoin value

  • Liquidation station russellville ar movie

    Dogecoin solo mining cgminer configuration

  • Bitcoin charts mtgox audrands

    Bitcoin price is going to explode in q2 2018heres why

Bitgo stock quotes

17 comments Bitcoin price drop 2013

Brian koffler bitcoin values

How "mining" works is at the very heart of Bitcoin. It is often brushed over and simply referred to as "complicated math" in the media , but it's actually quite simple to understand even if it is computationally intensive to solve. Most of the content in this post comes from a post on Reddit that I have edited, reformatted, and elaborated on. Feel free to read the original post if you prefer. Understanding hashes is the first step in understanding mining.

A hash will take an input of any length, and generate is seemingly randomised output of a specific length. The same input will always generate the same output, but changing just one character will drastically change the output. For example, af2f0fb8fbb0d2ed1c1cd2a1ec0fb85daa is the hash of hello world , and 30ede9ea08ff1adb8aa6be05fdf84aeacabb5 is the hash of hello worle.

This behaviour makes it very difficult to predict what input gives a particular output. For example, what input gives aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa as a hash? It's effectively impossible to work it out. People will often build lookup tables that map these inputs to outputs in order to perform quick reversals later. These tables are called rainbow tables and rely on the input already having been hashed.

The second step is to get the idea of a proof of work. It might be impossible to find a hash specifically with a string consisting of nothing but the letter "a" but what if we asked for a hash with a single zero at the front? Altering the last letter of hello world took 26 attempts to finally get hello worlC which equates to 0d7eae0fab3abc2cccc0bb4aabb24ffaf8c. Why is this useful? Because it creates a puzzle whose difficulty is measurable and which it's impossible to perform better than blind guessing.

That second property is important because it's the only way to create a fair "mining" system. Miners solve such puzzles as above but which are far more difficult. For example, find a hash that looks like this: Each hash is can be considered to be just a number. For example, the hash ab3abc2cccc0bb4aabb24ffaf8c has a numeric value of So in mining, the miners have to achieve a hash with a numeric value lower than a specified number.

This number is called the target. If your hash attempt gives you a number less than the target, which is the same thing as having a bunch of zeros at the front of the hash, then you win and you get to "mine the block".

To find such a small hash takes millions of attempts, or more accurately, the whole mining network, with everyone trying at the same time, needs millions of billions of tries to get it right. The part of the content that they are hashing and are allowed to change, a single number, in order to try and get a hash beginning with zeros, is called the nonce.

The current block reward of 25 Bitcoins is given to the miner who successfully "mines the block" finds the appropriate hash. It's not really that mining "generates" the Bitcoin in any sense, it's just that it's written into Bitcoin code that a transaction block starts with a unique transaction called a "coinbase" transaction, which is the only type of transaction with no inputs.

It only has an output, consisting of the reward plus the transaction fees. To make any sense of Bitcoin's solution to this problem, you need to understand also what is meant by "distributed timestamp server" and how proof of work hashes can be used to construct this. It is, very briefly, explained in Sections 3 and 4 of the bitcoin whitepaper.

You're creating a sequence of blocks, tied to each other by including the hash of the last one in the next one. This proves that the next block knew about the last block remember, hashes are totally unpredictable , which proves that it came afterwards. However, that's not enough; you might know that block 8 comes after block 7, but what if a different block 8, put in by a different miner, also comes after block 7?

Worse still, what if these two competing blocks, 8a and 8b contain different transactions, spending money to different places? Which one is the "true" block of transactions? The reason miners did the complicated proof of work process above is exactly to solve this problem.

In bitcoin, the chain of blocks with the largest total proof of work embedded in it is the "winner". The reason this is such a good way of deciding is that it makes it incredibly difficult for an attacker someone, say, who wants to spend the same Bitcoins twice to create an alternative single block or chain of blocks and try to convince everyone else on the network that theirs is the right one.

Since everyone else is working on the "true" chain, they have an enormous amount of CPU power working together to create it. Lastly, here is Satoshi's explanation of the Byzantine Generals' problem. Hopefully you can see how it connects. The math problem that these mining computers solve serves no purpose other than to secure Bitcoin's network from attackers wishing to "double spend".

Miners are not creating a massive rainbow table or computing the human genome. As more computers are thrown at the problem, and hardware advances, the problem is artificially made more difficult to compensate. This seems incredibly wasteful to me as we start to read about the electrical costs of the Bitcoin network and think about the fact that Bitcoin could easily run on just 3 computers to be considered distributed. This is why I have high hopes for alternative cryptocurrencies, such as Peercoin , that implement proof-of-stake.

The network could run on multi-purpose devices, such as people's phones and tablets rather than purpose-built and costly ASICs that will be redundant in a few years.

Programster's Blog Tutorials focusing on Linux, programming, and open-source. Bitcoin's Mathematical Problem bitcoin mining.

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.