Getting Issue on eth transfer on mainnet icp

Getting this error when I am deployed on mainnet icp cannot able to transfer eth
(variant {Ok=variant {Consistent=variant {Err=variant {JsonRpcError=record {code=-32000; message=“invalid sender”}}}}})

What are you trying to do? How are you transferring ETH?

I am using TxpEip1559 for sending raw txn , It is working correct in locally but as soon as I deployed icp on mainnet getting issue .
(variant {Ok=variant {Consistent=variant {Err=variant {JsonRpcError=record {code=-32000; message=“invalid sender”}}}}})

Are you using the EVM RPC Canister or calling an RPC directly using HTTPS Outcalls?

This error does seem independent of ICP. Based on other Ethereum forum posts for this error, you should check if the gasLimit and the correct chainID is set.

Have you tried that?

I am using rpc canister .
Yes they are correct too , but it is working fine on locally ?
like below

pub async fn estimate_transaction_fees() -> (u128, u128, u128) {
    const GAS_LIMIT: u128 = 500_000; // Gas limit
    const MAX_FEE_PER_GAS: u128 = 25_000_000_000; // Updated max fee per gas to include priority fee
    const MAX_PRIORITY_FEE_PER_GAS: u128 = 10_000_000_000; // Max priority fee per gas
    
    (GAS_LIMIT, MAX_FEE_PER_GAS, MAX_PRIORITY_FEE_PER_GAS)
}

chain id

1115111

The only difference between mainnet and local is that mainnet does go through consensus.

@rvanasa Have you encountered this error while using the EVM RPC only on mainnet?

Do I need to make other changes for deploying canister on mainnet I am using sepolia only ?

You should not have to.

I personally haven’t seen this error message before. @Rachit2323, which RPC provider(s) are you using for the request? It might be possible to work around this by switching to a different provider (see RpcServices in the documentation).

1 Like

Hi @Rachit2323,

are you trying to access funds from the same account on Sepolia? Your canister will have a different threshold key and address/account locally and on mainnet.

1 Like

when I decode the raw txn hash it is taking always the different sender why ?
I am using

        chain_id,
        nonce,
        gas_limit,
        max_fee_per_gas,
        max_priority_fee_per_gas,
        to: TxKind::Call(to.parse().expect("failed to parse recipient address")),
        value: nat_to_u256(Nat::from(user_amount)).await,
        access_list: Default::default(),
        input:Default::default(),
        // input: Bytes::from(data),
    };```
It should always take canister as sender prev it was taking but now getting different sender always

It’s not clear from this snippet how you’re populating the ‘from’ field of the transaction and compute the signature.

As mentioned above, the canister on ICP mainnet will have a different Ethereum address than the canister on local dfx.

yes I am using from same …getting issue again …
Manytime it used to sign from different signer , how to make the txn sign with my ecdsa .
Bcoz , I think it is only the reason of it ?
How it is getting different sender address ?

// let message_hash = transaction.rlp_signed(signature);

    // // Define derivation_path and key_id
    // let derivation_path = vec![]; // Replace with the actual derivation path
    // let key_id = EcdsaKeyId {
    //     curve: EcdsaCurve::Secp256k1,
    //     name: ecdsa_key.to_string(), // Replace with the actual key ID name
    // };
let recovery_id = RecoveryId::new(/* is_y_odd */ true, /* recid */ false);

    // // You might need to pass the recovery_id into a function that requires it
    // // If you're working with a method that expects the `is_y_odd` function, do it like this:
    // let is_y_odd = recovery_id.is_y_odd();

    // let signature = Signature::from_bytes_and_parity(&signature, is_y_odd)
    //     .expect("BUG: failed to create a signature");

    // ic_cdk::println!("signature , {:?}", signature);

    // let signed_tx = transaction.into_signed(signature);
    // let raw_transaction_hash = *signed_tx.hash();
    // let mut tx_bytes: Vec<u8> = vec![];
    // TxEnvelope::from(signed_tx).encode_2718(&mut tx_bytes);
    // let raw_transaction_hex = format!("0x{}", hex::encode(&tx_bytes));

This is how I am signing it .
please verify ?

1 Like