I have some gaps in my understanding of the transaction's lifecycle that I want someone to help me specifically fill with the validation.
What I understand with my questions about the life cycle:
1] The transaction is logged out by the user through the Wallet app and sent to the Blockchain network.
The question at this step is: Does the Wallet app perform a transaction validation that requires checking the entire history of the blockchain at this level?
2] The sent transaction is now sent to many nodes in the network, and these nodes forward or "propagate" the transactions to other nodes until all nodes have that transaction in their "pool of unconfirmed transactions"?
Tell me if a part is wrong or not, in the right order
3] Each miner selects some transactions and starts mining.
When the miner selects the transactions, does he at this level validate each transaction that requires a full scan of the history of the blockchain?
4] When the miner releases the block, it sends this block, along with the hash value it generated, to the blockchain network in the same way that the transaction was sent to some nodes and passed to the rest. Then the nodes will hash the block header to see if it generates the same hash or not so they can accept that block.
The question here is: Do the nodes revalidate all transactions sent with the block header to make sure that they are genuine transactions that were not created by the miner who solved the block?
Does the validation of these transactions require a review of the entire history of the blockchain?
I know how Merkle trees has multiple transactions and that any change to the hash of a transaction alters the value of the Merkle root, but my question here is how helpful that is. Would the miner who has already faked one of the transactions not have the correct Merkel root for all transactions in the block, since he is the one who added them first? My point is, how does merkle root help? What value does it add? What kind of attack prevents it?
The final question is the consensus that, by definition, all nodes agree that they are at the same level as the new block. I know the PoW, but how do all the nodes check and communicate with each other to confirm that they all have the same block?