Comparing to traditional printing of fiat money during the time of demand, bitcoin is discovered through the process of mining. Computers (which so ever involved) through out the world are working over the mining of bitcoin and are in continuously in competition with each other till the process of mining completes.
Bitcoins are transacted or transferred from one person to other over a network on regular basis 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 particular period into a list, called a block. It’s the miners’ job to confirm those transactions, and write them into a general ledger.
This general ledger ‘blockchain’ can be used to find out the transactions made between any bitcoin addresses, at any point of time on the block chain network. Whenever a new block of transactions is created, it is added to the blockchain, creating an increasingly lengthy chain of blocks of 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 and all of this is held digitally. But a general ledger has to be trusted.
How can we be sure that the blockchain stays intact, and is never tampered with?
This is where the miners come in.
What the miners do ?
when a transaction made a block (keeping the record of it) occured and miners put it through a process. They take the information in the block, and apply a mathematical formula to it, turning it into some unidentified value. That unidentified value 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. New block is added getting the gene from the previous block and hence if the gene of the parent block is altered or new block is changed the forthcoming additions is hampered and the system does not allow further process and hence everyone would know about the alteration.
Simply we can say 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. 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.
So, 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 some 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.
IS IT SO SIMPLE ? answer is no,,,,not at all
Computers are really good at producing a hash from a collection of data whereas the bitcoin network has to make it taskably 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 does not allow addition of new hash or block without verification but it demands that adding block’s hash has to look like a certain way; it must have a certain number of zeroes at the start or else. 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 change the data they’re using to create a different hash without altering previous one. 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 a bitcoin is discovered by a miner.