0

at client, I create a signature from seed like this. the key pair is [ '5KgLbwEy7d4qufeLqPnPL1YQU1tscJXCnpqTTn7REaZsjYBjDWr', 'EOS5Mk748B6ojrZdTHP8BoLBXyKjQzzthaqGa4v97vfiGEfbEM2Np']

import ecc from 'eosjs-ecc'
const seed = "aef77b75edac412e578946420597047a514df6b21a8857e0454896efeb3a4ccf"

let signature = ecc.sign(seed, '5KgLbwEy7d4qufeLqPnPL1YQU1tscJXCnpqTTn7REaZsjYBjDWr')
console.log("seed: " + seed)
console.log("signature: " + signature) // THis is the signature what i use 

let verified = ecc.verify(signature, seed, 'EOS5Mk748B6ojrZdTHP8BoLBXyKjQzzthaqGa4v97vfiGEfbEM2Np','utf8',false)
console.log("verified: " + verified) // true!

I sent a action to a eos contract using cleos

cleos.sh push action eosaccount11 finishbet '{"seed":"aef77b75edac412e578946420597047a514df6b21a8857e0454896efeb3a4ccf", "sig": "SIG_K1_..(above signature sting)"}' -p eosaccount11

And finally in the contract,

void finishbet(checksum256 seed, signature sig) {
    assert_recover_key(&seed, (const char *)&sig, sizeof(sig), (const char *)&public_key, sizeof(public_key)); 
// public key is EOS5Mk748B6ojrZdTHP8BoLBXyKjQzzthaqGa4v97vfiGEfbEM2Np

But when I push action, result is Error 3230001: Crypto API Exception Error Details: Error expected key different than recovered key

How can I create a valid signature for assert_recover_key function ?

Any help please.

Your Answer

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

Browse other questions tagged or ask your own question.