Skip to content

invalid sender: eth_sendRawTransaction #871

@saykowa

Description

@saykowa

Hi there. Have a problem with sending transactions at Polygon Network. Code below works perfectly with BSC and ETH but POLYGON doesn't work..
Also i can get Balance and GasPrice from RPC by SendRequestAsync() function at Polygon but transactions can't be reached :/

Transaction function

    public static async Task<bool> SendTransaction(Web3 web3, decimal amount)
    {
        try
        {
            var transactionManager = web3.TransactionManager;
            var fromAddress = transactionManager?.Account?.Address;
            var transactionInput = EtherTransferTransactionInputBuilder.CreateTransactionInput(fromAddress, Config.reciepment, amount);
            var rawTransaction = await transactionManager.SignTransactionAsync(transactionInput);
            var txnHash = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync(rawTransaction);
            var txnReceipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(txnHash);
            Console.WriteLine($"[{fromAddress}] {txnHash}");
        }
        catch (Exception e) 
        {
            Console.WriteLine(ConsoleExtensions.Pastel("Error: ", System.Drawing.Color.OrangeRed) + e.Message);
        };

        return true;
    }

Error

invalid sender: eth_sendRawTransaction

Additional info (important)

  1. I'am using legacy mode web3.TransactionManager.UseLegacyAsDefault = true;. Find issue on github with the same error /Nethereum/issues/750, but while trying do same still nothing works.
  2. Account created with chainId new Account(privatekey, chain.Id)
  3. Web3 Interface created with RpcURL new Web3(account, chain.RpcUrl)
  4. Polygon RPC which i'am using is official Polygon-RPC
  5. ChainData class structure
    public class ChainData
    {
        public string Name { get; set; }
        public string RPCUrl { get; set; }
        public System.Numerics.BigInteger Id { get; set; }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions