Skip to main content

How Bitcoin Mining Works

In traditional fiat money systems, governments simply print more money when they need to. But in bitcoin, money isn’t printed at all – it is discovered. Computers around the world ‘mine’ for coins by competing with each other.

How does mining take place?

People are sending bitcoins to each other over the bitcoin network all the time, but unless someone keeps a record of all these transactions, no-one would be able to keep track of who had paid what. The bitcoin network deals with this by collecting all of the transactions made during a set period into a list, called a block. It’s the miners’ job to confirm those transactions, and write them into a general ledger.

Making a hash of it

how bitcoin mining worksThis general ledger is a long list of blocks, known as the 'blockchain'. It can be used to explore any transaction made between any bitcoin addresses, at any point on the network. Whenever a new block of transactions is created, it is added to the blockchain, creating an increasingly lengthy list of all the transactions that ever took place on the bitcoin network. A constantly updated copy of the block is given to everyone who participates, so that they know what is going on.
But a general ledger has to be trusted, and all of this is held digitally. How can we be sure that the blockchain stays intact, and is never tampered with? This is where the miners come in.
When a block of transactions is created, miners put it through a process. They take the information in the block, and apply a mathematical formula to it, turning it into something else. That something else is a far shorter, seemingly random sequence of letters and numbers known as a hash. This hash is stored along with the block, at the end of the blockchain at that point in time.
Hashes have some interesting properties. It’s easy to produce a hash from a collection of data like a bitcoin block, but it’s practically impossible to work out what the data was just by looking at the hash. And while it is very easy to produce a hash from a large amount of data, each hash is unique. If you change just one character in a bitcoin block, its hash will change completely.
Miners don’t just use the transactions in a block to generate a hash. Some other pieces of data are used too. One of these pieces of data is the hash of the last block stored in the blockchain.
Because each block’s hash is produced using the hash of the block before it, it becomes a digital version of a wax seal. It confirms that this block – and every block after it – is legitimate, because if you tampered with it, everyone would know.
If you tried to fake a transaction by changing a block that had already been stored in the blockchain, that block’s hash would change. If someone checked the block’s authenticity by running the hashing function on it, they’d find that the hash was different from the one already stored along with that block in the blockchain. The block would be instantly spotted as a fake.
Because each block’s hash is used to help produce the hash of the next block in the chain, tampering with a block would also make the subsequent block’s hash wrong too. That would continue all the way down the chain, throwing everything out of whack.

Competing for coins

Butterfly Labs Bitforce mining rigSo, that’s how miners ‘seal off’ a block. They all compete with each other to do this, using software written specifically to mine blocks. Every time someone successfully creates a hash, they get a reward of 25 bitcoins, the blockchain is updated, and everyone on the network hears about it. That’s the incentive to keep mining, and keep the transactions working.
The problem is that it’s very easy to produce a hash from a collection of data. Computers are really good at this. The bitcoin network has to make it more difficult, otherwise everyone would be hashing hundreds of transaction blocks each second, and all of the bitcoins would be mined in minutes. The bitcoin protocol deliberately makes it more difficult, by introducing something called ‘proof of work’.
The bitcoin protocol won’t just accept any old hash. It demands that a block’s hash has to look a certain way; it must have a certain number of zeroes at the start. There’s no way of telling what a hash is going to look like before you produce it, and as soon as you include a new piece of data in the mix, the hash will be totally different.
Miners aren’t supposed to meddle with the transaction data in a block, but they must change the data they’re using to create a different hash. They do this using another, random piece of data called a ‘nonce’. This is used with the transaction data to create a hash. If the hash doesn’t fit the required format, the nonce is changed, and the whole thing is hashed again. It can take many attempts to find a nonce that works, and all the miners in the network are trying to do it at the same time. That’s how miners earn their bitcoins.

Comments

Popular posts from this blog

How Blockchain Could Help Tech Giant Cisco Reboot

Cisco is changing. The technology firm best known as the supplier of enterprise computer hardware has seen a slow, steady decline in revenue from some of its core products. As a result of an increasing number technological services being virtualized, and the storage of information moving to the cloud, the $158bn firm has been  restructuring  and exploring new ways to capitalize on connected devices. But amidst this change in identity, it's in identity itself where some of the California-based company's most interesting new experiments are taking place. With a series of early stage blockchain  projects , Cisco is now pushing even deeper into what could end up being much more than a way for employees to prove who they are across subsidiaries. In conversation with CoinDesk, Robert Greenfield IV, Cisco software engineer and executive team lead of the firm's Connected Black Professionals resource group, explained how several blockchain projects have evolv...

Bitcoin in Africa: Insights from the Continent’s Biggest Bitcoin Exchange

Isn’t it absurd that nearly 326 million people representing 80% of the adult population in Africa do not have access to bank accounts? This wretched situation denies countless of people financial freedom in the so-called dark continent. Bureaucratic tenors and economic exclusion inter alia have paved the way for the current phenomenon. Last year a study of 10 African nations with unusual inflationary ratio had South Sudan registering an unimaginable inflation rate of 295 percent. Egypt had the slightest with 12.30 percent. African governments continue to plunder the riches of the African people through Inflation. This makes it considerably insurmountable for individuals to conserve their resources. Moreover, public sector borrowing has crowded out the efficient private sector that can put credit to good use. The IMF estimates that averagely credit to the private sector is estimated at 30 percent of GDP in Sub-Sahara Africa. CCN spoke to Werner van Rooyen, Head of Business Develo...

WANT TO BUY BITCOIN IN SOUTH AFRICA , KENYA, UGANDA, NIGERIA, GHANA OR OTHER COUNTRIES IN AFRICA? SIMPLE.

With the growing awareness around Africa of bitcoin as a crypto-currency, a means of remittance and a creator of  wealth, more and more people in more and more countries are looking to buy it, and asking how and where they can buy it. Purchasing bitcoin is simple. Simply go online and do a search for “Buying and selling bitcoin in South Africa ““Buying and selling bitcoin in Kenya “Buying and selling bitcoin in Uganda ““Buying and selling bitcoin in Nigeria “ or  “Buying and selling bitcoin in Ghana“ – you get the idea.   To help you though:   In South Africa, three of the most common (and trusted) platforms are: www.localbitcoins.com www.luno.com www.bitx.co In Kenya, the most common (and trusted) platforms) are: www.localbitcoins.com www.bitpesa.co whilst other platforms include: www.altcoins.io www.99bitcoins.com In Uganda, the most common (and trusted) platforms) are: www.localbitcoins.com www.bitpesa.co whilst other platforms incl...