Error from secp256k1 ECDSA ecdsa_recover_internal
#450
-
Discord user IDNo response Describe your question in detail.My goal is to securely confirm that a user's ETH address is owned by an Aptos address and vice versa - essentially a 'handshake'. The way I want to do this is:
in I have implemented the logic, but I am getting the error: native fun ecdsa_recover_internal( I have confirmed my args are parse in correctly: let eth_address = x"<>"; // Your Ethereum address What error, if any, are you getting?native fun ecdsa_recover_internal( this What have you tried or looked at? Or how can we reproduce the error?I've verified args are parsed and loaded in correctly, the hashed messages line up too I looked through aptos github for the error code, and nothing useful came up. Only relevant this is here: https://github.com/aptos-labs/nft-tutorial/blob/9d13e34eb5482f740f57b5c3e7db71e8d091e7e6/tutorial/step_5/BasicCoin/build/BasicCoin/sources/dependencies/AptosFramework/account.move#L643 this error suggests public key cannot be found... potential issue could be that ETH public keys aren't acceptable on aptos for some reason? Which operating system are you using?macOS Which SDK or tool are you using? (if any)Aptos CLI Describe your environment or tooling in detailNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 19 replies
-
here is code framework btw:
|
Beta Was this translation helpful? Give feedback.
-
Can you post the full code with the Move test and the input data please? 🙏 |
Beta Was this translation helpful? Give feedback.
Ok I figured it out - it seems for some reason
SigningKey.computePublicKey(process.env.ETHEREUM_PRIVATE_KEY)
which I was using to view the public key given my PK has this property:// raw public key; use uncompressed key with 0x04 prefix
if (bytes.length === 64) {
const pub = new Uint8Array(65);
pub[0] = 0x04;
pub.set(bytes, 1);
bytes = pub;
}
so they were the same public keys, it just appended 0x04 to the front (not sure why they do this)
So, it turns out that my signatures are producing the right output and recovering the Public Key correctly.