I am trying to create a simple function that signs (either a message or a raw transaction) and then broadcasts this transaction to the chain using ethers. The problem I’m having is that even with the same raw transaction, the same derivation path, and without re-deploying the canisters, each time I sign the transaction, the signer address I get from it (using ethers) returns a different address. Why is this happening?
The code snipet of interest - Im using Azle:
const signatureResult = await ic.call(
managementCanister.sign_with_ecdsa,
{
args: [
{
canister_id: None,
message_hash: final,
derivation_path: derivationPath2,
key_id: {
curve: { secp256k1: null },
name: 'dfx_test_key'
}
}
],
cycles: 10_000_000_000n
}
);
const ff = ethers.hexlify(signatureResult.signature)
const here0 = ethers.Signature.from(ff).serialized
const broadcast0 = serialize(txObject, here0)
console.log(Transaction.from(broadcast0).fromPublicKey)
console.log(Transaction.from(broadcast0).from)