Closed dudo50 closed 1 week ago
You can do this for substrate transactions:
import { Keyring } from "@polkadot/api";
import type { KeyringPair } from "@polkadot/keyring/types";
const keyringEth = new Keyring({ type: "ethereum" });
export const signer: KeyringPair = keyringEth.addFromUri("0x...private_key");
tx.signAndSend(signer);
@RomarQ that would, however, require us to have the private key of the user. We get the ethers signer from the wallet connect component so we do not have their private key. Is there any workaround on how to convert ethers to substrate-compatible signers? Thanks!
You can use wallets like (Talisman and SubWallet) which offer support for both Substrate and Ethereum ecosystems.
If you want a other solution, you will need to handle the encoding and use a different signing method for substrate transactions, since signMessage
does some special things to the data being signed (something like eth_sign(message) => sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))
)
Hello, is it possible to sign Moonbeam transactions with ethers or viem signers?
Because we had no success with this. Is there any function to convert Ethers to Substrate EVM signer? Thanks!