0

I want to be able to verify that a signature is signed by a public key's address in my smart contract method on tezos. For example with solidity see: https://ethereum.stackexchange.com/questions/2171/how-does-one-properly-use-ecrecover-to-verify-ethereum-signatures

I know there is a way to verify a signatures by public key, but I don't understand how I would apply this to my smart contract without passing the full public key (as a parameter maybe).

Is there a better way? Basically I just want to validate a signature sent to the contract was signed by the public key for a known address without knowing the full public key.

If I deal in public keys can a verify the public key represents the same address in-contract?

My apologies for any misunderstandings and if I'm not asking this question properly!

1

For implicit accounts, the address is nothing more than the hash of the public key so this means that you can compute the address from the public key but not the other way around.

In Michelson, you have:

I don't understand how I would apply this to my smart contract without passing the full public key (as a parameter maybe).

You need the public key, how you get it depends on your application but it will probably be in the same way you got the signature or in the same way you got the address.

2
  • In ethereum, I can get the address from the signature using ecrecover. The reason I cannot in tezos is due to design differences I guess? Thanks for your clarification – jon Jan 9 at 16:49
  • After doing some digging, I see now that it boils down to the fact that tezos uses a few different key types but one of the types Ed25519 relies on EdDSA for signatures which does not allow public key recovery from the signature. So therefore we need the public key to do this similarly. Ethereum uses ECDSA for signatures which does allow public key recovery so no need to have the public key in this case, the address is enough. – jon Jan 9 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.