For a signature done using a private key, we know that the corresponding public key is needed to verify. When the address is a one way hash function of the public key (which means from the address, it is infeasible to compute the public key directly), how does the public key recovery methods find the public key from the signers address, transaction message details including the digital signature? Is there a mapping between the addresses and the corresponding public keys from where the methods recover the public key or a service? Can someone show and explain.
Both the unencrypted data and the signed data are received. With those two things the public key can be figured out, and then the sender's address from the public key.
I guess this is a cryptography question, so crypto.stackexchange.com is it's natural home.
My earlier assumption (which is incorrect), based on which i posted the question was that, the signed transaction does not contain the public key. But I found out that in the bitcoin context every signed transaction comes with an Unlocking Script (scriptSig) which contains both signature and public key . Since public key is available in the transaction block itself, signature can be directly verified from that. In other contexts like in ethereum addressed below, where it is not directly there in the transaction the platform fetches it through a method. It is clear now that the signer's public key is provided by the signer to the miner for verification.
In the Ethereum context following is the way verification is done: "ECDSA signatures in Ethereum consist of three parameters r, s, and v. Solidity provides a globally available method ecrecover that returns an address given these three parameters. If the returned address is the same as the signer’s address, then the signature is valid.
Signatures produced by web3.js are the concatenation of r, s, and v, so a necessary first step is splitting those parameters back out.
Both smart contracts and Ethereum clients have the ability to verify ECDSA signatures." - For more details refer to the source of the above quote: https://yos.io/2018/11/16/ethereum-signatures/