blockchain – End to end bitcoin transaction flow

[ad_1]

My understanding on bitcoin blockchain technology after going through some articles in past few days. I’m not sure that my understanding is 100% correct. I’m writing so that someone can correct me which will also be helpful for other newcomers.

Case: A wants to send 10 BTC to B 

  1. A created an address which is a hash (SHA 256) of several words. Similar for B. This is the private key; ownership validator of Bitcoin amount. Using private key, public key is generated. Wallet applications offer seed words which generates private address by hashing with SHA256 so that even private key is lost it can be relieved from the secret seed words. This public key is known to everyone but private key is secret and must not be shared. It is not possible to get the private key from the public key. Private key is the mathematical proof that A has right to spent certain amount of BTC. This is proving the ownership of money. Let, somehow A has more than 10 BTC right now.

  2. A sends 10 BTC to B’s public key. Public key is the ‘to address’ of the transaction. The message (A sends 10 BTC to B) is signed using A’s private key. This is digital signature for the transaction. This transaction message is broadcasted to everyone (the entire blockchain network nodes). Digital signature confirms that the real owner has created the transaction.

  3. The miners will pick this transaction along with other pending transactions and try to create next block of the blockchain. All the transactions are open to everyone. For the example transaction case, miners will validate the transaction whether A really has more than 10 BTC by checking the complete blockchain database (all the completed blocks of the chain). If not, the transaction will be rejected and won’t be added to the block he will try to solve the puzzle.

  4. The miners will validate number of transaction from the pending transactions (the transactions which are not added to any block in the blockchain yet). 

  5. Different Miner can take different number of valid transactions to form a block. But the miner who wins the mathematical puzzle, his created block will be added as next block to the blockchain. This puzzle is to get hash (SHA 256) as per current difficulty (19 leading zeros of the hash in hex format). This is a trial and error basis process to get the desired hash having 19 zeros. Hash output function looks like below – 

SHA256(timestamp + previous block’s hash + MarkleRootHash(all valid transactions taken in this block) + nonce)

Miners change nonce (integer number) value every time he tries to get the desired hash according to above mentioned hash generation format. It requires enormous amount of tries hence huge compute power to solve the puzzle. Suppose, a miner has just got hash having 19 zeros. Note that the transaction “A sends 10 BTC to B” is valid and exists in this example block whose hash has just found with 19 leading zeros. 

  1. The miner has got the desired hash with a lucky nonce value. Using this nonce value anyone can validate the output 19 zeros hash; hence it is the successful block. This nonce value is actually the proof-of-work. When majority of miners will validate the nonce and get prof-of-work successful, it is gaining to the consensus. Then, the block gets added the blockchain database. 

  2. As this block contains transaction “A sends 10 BTC to B”. This transaction is also completed successfully. B gets 10 BTC. Ownership of this 10 BTC is with B as B has the private key of the public key used as ‘to address’ of the example transaction. 

[ad_2]

Source link


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *