We already know that Bitcoins are generated through a process called mining. But what is this mining and how it is done?
People are sending bitcoins to each other all the time. Unless someone keeps a track of record of all these transactions, no one will be able to keep track of who paid whom. Its a miner jobs to confirm these transaction and write them into the ledger.
The bitcoin network compiles list of transactions in a certain period in a list called Block. The ledger is a list of blocks, hence the name Blockchain. It can be used to explore any transaction between any bitcoin address, at any point of network. So every time a group of transactions or a block is confirmed, it is added to the Blockchain.
The general ledger, is held digital and it has to be made sure that it is not tampered with. This is where the role of 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.
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.
Each block has a hash of its own. Think of it is a pointer to the next block
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.