It has been said that Bitcoin transactions are completely secure and, usually, relatively quick. But, what’s going on under the hood? How exactly do the transactions work? This infographic does a terrific job of explaining.
Essentially, each Bitcoin transaction takes place between two wallets. Each of these wallets has a public addresses, which can be given out to receive coins, and a private address, which only the owner of the wallet should know. Once a transaction is enacted, it is sent into the blockchain for verification by the miners. There, the transactions are bundled into transaction blocks (each transaction block is filled with the last 10 minutes of transactions). The miners’ computers are set up to calculate cryptographic hash functions. These hash functions transform a collection of data into an alphanumeric string with a fixed length, or hash value. From there, different hash values are created using nonces, a random number added to the data prior to hashing.
The miners’ computers then calculate the new hash values based on the nonce, the transaction block and the previous hash value. The whole idea here is that the new hash value has to begin with a certain number of zeros. But the miners have no way of knowing which nonce will create the correct amount of zeros, therefore, many hashes with different nonces are created until the correct one is found.
Once the correct number of zeros (the winning nonce) is found, the miner is rewarded with Bitcoin, which is sent to his wallet’s public address. Finding the correct number of zeros also confirms the transaction. The reward helps to ensure that people continue to create coins, as well as confirm transactions.
Any attempt to change this transaction is nearly impossible, because a new winning nonce would be needed — which is a statistical improbability.
And now you know.