When a miner can find a number to create a hash with enough zeros, the other miners can verify his work by testing that number and seeing if everything is correct. But how do they verify that the transactions in the block are not false? How do they see that the amounts are properly authorized? An attacker could create a transaction in which Alice sends him 5 BTC, without Alice knowing about it. Is it possible?
2 Answers
The block validation process involves checking that all the individual transactions in it are all valid according to the consensus rules which are set in the Bitcoin Core C++ implementation.
Block validation is done by Bitcoin full nodes and one would assume by all miners. If a block is not valid then it will be rejected and any miner who attempted to insert an invalid transaction would have wasted all the time and effort to generate the block hash.
-
"checking that all the individual transactions in it are all valid" How is performed this action? Dec 8, 2017 at 8:28
-
In the case of a Bitcoin Core full node, for block verification see github.com/bitcoin/bitcoin/blob/master/src/validation.cpp and for transactions see github.com/bitcoin/bitcoin/blob/master/src/consensus/…. Other wallet software or miners may or may not employ equivalent logic. Dec 8, 2017 at 9:12
But how do they verify that the transactions in the block are not false? How do they see that the amounts are properly authorized? An attacker could create a transaction in which Alice sends him 5 BTC, without Alice knowing about it. Is it possible?
Most coins spent to addresses require a signature to spend them. That signature can only be generated if you know the private key(s) corresponding to the address which they were sent to. Without the private key, the transaction spending those coins is invalid, and anyone can see that it is invalid. Thus if a transaction with an invalid signature was included in a block, that entire block would be invalid too, and rejected by the network.