Can anyone please tell what's wrong with this signature smart contract?

On running block_hash() function, I expect it to return true but it returns false. Please verify this.

contract HelloWorld = 
    record state = { word : string}

    entrypoint init() = {word = ""}


    public entrypoint block_hash () : bool =
        // let hashstring = Bytes.to_str()
        // hashstring
        let msghash : bytes(32) = #928b20366943e2afd11ebc0eae2e53a93bf177a4fcf35bcc64d503704e65e202
        let sig : bytes(64) = #c910daedceebb658f49ad862b2032e6b455143ebc1d698e9018ac4cf2d76f65fefda254893b0f56203b4cef1ff549f72ef155d58792fd52d0c1b6e210525e207
        let signer : address = ak_Gd6iMVsoonGuTF8LeswwDDN2NF5wYHAoTRtzwdEcfS32LWoxm
        let x = Crypto.verify_sig(msghash, signer ,sig )
        x
        // Option.force(x)
1 Like

Yes, that does not seem to be a valid signature:

(aeternity_ct@localhost)10> {ok, PK} = aeser_api_encoder:safe_decode(account_pubkey, <<"ak_Gd6iMVsoonGuTF8LeswwDDN2NF5wYHAoTRtzwdEcfS32LWoxm">>).                                        
{ok,<<35,120,248,146,183,204,130,194,210,115,158,153,78,
      201,149,58,163,100,97,241,235,90,74,73,165,176,222,
      ...>>}
(aeternity_ct@localhost)11> Sig = aeu_hex:hex_to_bin("c910daedceebb658f49ad862b2032e6b455143ebc1d698e9018ac4cf2d76f65fefda254893b0f56203b4cef1ff549f72ef155d58792fd52d0c1b6e210525e207").
<<201,16,218,237,206,235,182,88,244,154,216,98,178,3,46,
  107,69,81,67,235,193,214,152,233,1,138,196,207,45,...>>
(aeternity_ct@localhost)12> MsgHash = aeu_hex:hex_to_bin("928b20366943e2afd11ebc0eae2e53a93bf177a4fcf35bcc64d503704e65e202").                                                            
<<146,139,32,54,105,67,226,175,209,30,188,14,174,46,83,
  169,59,241,119,164,252,243,91,204,100,213,3,112,78,...>>
(aeternity_ct@localhost)13> aeu_crypto:verify_sig(MsgHash, PK, Sig).                                                                                                                     
false
3 Likes