Deriving an evm address for a cansiter

I have been trying to derive an evm address (base chain) by doing something like this

/// getEvmAddress : Derive EVM address from secp256k1 pubkey
public shared func getEvmAddress() : async Text {
let pkResult = await getEcdsaPublicKey();
switch (pkResult) {
case (#err(e)) {
let msg = switch(e) {
case (#GenericError(text)) { text };
case (#InsufficientFunds) { “Insufficient funds” };
case (#InvalidSignature) { “Invalid signature” };
case (#NonceTooHigh) { “Nonce too high” };
case (#NonceTooLow) { “Nonce too low” };
case (#NotOwner) { “Not owner” };
case (#RpcError(text)) { text };
};
"ERROR_ECDSA_PUBKEY: " # msg
};
case (#ok(pubKey)) {
if (pubKey.size() < 65) {
“ERROR: unexpected pubKey size”
} else {
let raw = Array.tabulate(64, func(i) {
Blob.toArray(pubKey)[i + 1] // skip 0x04
});
let sha3 = SHA3.Keccak(256);
sha3.update(raw);
let hash = sha3.finalize();
let addrBytes = Array.subArray(hash, hash.size() - 20, 20);
“0x” # Hex.encode(addrBytes)
};
};
};
}

I’m using key_1 as I’m doing this on main net. It seem unable to get the address as it’s ERROR_ECDSA_PUBKEY and it cannot route to management canister and it’s supply keys. Any thoughts from the big brains here?