Bitcoin transaction and how it works?
Bitcoins exist as records of Bitcoin transactions
We define bitcoin as a chain of digital signatures. Each owner transfers bitcoin to the next by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin. A payee can verify the signatures to verify the chain of ownership.
— Satoshi Nakamoto, Bitcoin Whitepaper
Ever wondered how the mining process on a blockchain works, or how a transaction gets confirmed and is added to the blockchain?
So have I.
And since I couldn’t find any clear step-by-step explanation of this process, I decided to write one myself. Here is how a blockchain transaction is processed on a blockchain, in the following steps:-
Let’s introduce bitcoin transaction procedures with the following scenario:
~Bob, an online merchant, decides to accept bitcoins as payment.
Alice, a buyer, has bitcoins and wants to purchase merchandise from Bob.
Wallets are files that provide access to multiple bitcoin addresses.
An address is a string of letters and numbers, such as 1HULMwZEPkjEPech43BeKJL1ybLCWrfDpN. Each address has its own balance of bitcoins.
Imagine the addresses as bank accounts, but they work a bit differently. Bitcoin users can create as many addresses as they want.
Bitcoin client software generates bitcoin addresses for users.
When Bob creates a new address, what he’s really doing is generating a ‘cryptographic key pair’, composed of a private key (which only Bob knows) and a public key (which is known to anyone). If you sign a message with a private key, it can be verified by using the matching public key.
Bob’s new bitcoin address represents a unique public key, and the corresponding private key is stored in his wallet. The public key allows anyone to verify that a message signed with the private key is valid.
The public key is used to receive bitcoins and the private key is used to sign transactions to spend those bitcoins.
When spending bitcoins, the current bitcoin owner presents their public key and digital signature in a bitcoin transaction to spend those bitcoins, by which he/she indicates the authorisation to spend the funds referenced by the transaction.
With the public key and the digital signature, everyone in the bitcoin network can verify and accept the transaction as valid, confirming that the person transferring the bitcoins owned them at the time of the transfer.