0

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. 

0

Broadly correct. A few minor details aren't right.

#1. Private keys are simply 256 bit numbers. They can be created by a random process or, in modern wallets, as part of a Hierarchical Deterministic sequence in which each key is generated in a repeatable way from a seed. See https://learnmeabitcoin.com/technical/hd-wallets. Also, the wallet address is not the public key itself - though it is derived from it. The site linked above explains this too.

#3. A transaction explicitly refers to previous transactions - and it is these which are checked for sufficient funds (not "the whole blockchain"). The new transaction will also deal with any excess funds.

3
  • I still need to know how transactions are getting verified by all nodes/miners? For example, if a miner takes 100 transactions and out of them 1 transaction is not valid (request has come for more amount than the balance) intentionally. And he reached to desired hash. Using nonce value, all other miners will be able to validate the block to reached to consensus. But how all miners came to agreement that all the transactions in the to be added block are valid? Jan 28 at 20:22
  • 1
    All transactions are individually validated by nodes. If a miner broadcasts a block containing an invalid transaction it will be rejected by nodes. In fact, invalid transactions are not even broadcast around the network. The job of validation is done by the bitcoin client running on all nodes.
    – marvb
    Jan 30 at 2:06
  • 1
    " 1 transaction is not valid (request has come for more amount than the balance)" Nobody other than the owner keeps track of or cares about balances. Other nodes (wallets, miners etc) only care that the individual "coins" (transaction inputs) have not already been spent and that the spending script (effectively proof of ownership) is satisfied. Feb 27 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.