The validity of the blocks

The validity of the blocks
When the miner decides the puzzle and "extracts" the block, all the nodes in the network conduct a check on the validity of the block and add it to its copy of the block. Nodes in the first place should reach a consensus on the validity of the block. Only after that the network is synchronized and the state of the block is updated.

The nodes will add the newly extracted block to the chain only if it meets the rules established by the mechanism for reaching consensus. The software on which nodes work, checks whether the block is valid or not. The invalid block will be rejected.

Naturally, the block is as valid as the transactions contained in it. Using the Bitcoin network as an example, it can be shown that protocol rules establish that no node can send bitcoins that it has not received from someone else or as a result of "mining" the block.

In other words, the node software checks all the transactions in the block to see if the senders have enough bitcoins to make transactions. To do this, they check the network status.

Now, say, I got 1 bitcoin, which I later send to Alice. Then I try to send the same bitcoin to Bob. Once the block with my first transaction is added to the chain, all nodes will update the block to reflect that I no longer have this bitcoin. Any newly "extracted" block that will contain my transaction with Bob will simply be rejected by the nodes. The node software determines that the block does not comply with the rules, so the nodes do not add this block and do not update the block system.

Also, the rules dictate that the transaction is valid only if it is signed by the digital signature of the bitcoat owner. Transaction can be signed only by the person managing the wallet or the address from which the bitcoy is sent. So only you can spend your bitcoyne.