I was trying to understand how Merkle tree works in SPV and many other scenarios in blockchain technologies and couldn't get my head around this one question: how the Merkle path is generated in validating a transaction.
In the graph below, suppose I'd like to validate the transaction 2, I understand the hashes of 3, 01, 4567 and the root are needed, however, I'm wondering how this Merkel path is generated at the first place.
When the transaction 2 is given to the server/node, how does the server/node know which path to return for validating 2? If the server already knew this path, why doesn't the server validate it and why bother to return this path?
Thanks