4

I am looking for a function with a type like this:

verifySignature :: Datum -> Signature -> PubKey -> Bool

which is also INLINABLE to use it inside validator.

I know that we can check if the whole transaction is signed by some pub key with this function, but this should be an arbitrary message signature, not transaction signature.

1
  • N.B. I want to store signed proof off-chain, so putting this Datum inside some output and singing it is not an option Commented Dec 7, 2021 at 13:36

2 Answers 2

4

I think PlutusTx.Builtins has what you need:

{-# INLINABLE verifySignature #-}
-- | Verify that the signature is a signature of the message by the public key.
verifySignature :: BuiltinByteString -> BuiltinByteString -> BuiltinByteString -> Bool

You can use verifySignature on-chain. If you do it on chain, then your signature and the PubKeyHash should be either some wrappers around BuiltinByteString or directly BuiltinByteString. Either way, there should be no problem getting the types needed for verifySignature.

3

There is also an oracle for signature verification here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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