3
static async Task SendTx(Wallet wallet, string toAddress, double amountOfCoins)
        {
            var accountFrom = new Account(wallet.GetAccount(0).PrivateKey, 137);
            
                        
            var web3 = new Web3(accountFrom, network);
            var wei = Web3.Convert.ToWei(amountOfCoins);
            decimal amt = 2.99m;
           var tx = await web3.Eth.GetEtherTransferService().TransferEtherAsync(toAddress, amt);

Throws an error for invalid sender: eth_sendRawTransaction. I create the Wallet in another function. When I try to debug it, the information looks correct. The from and to Addresses look good, I know the wallet has a balance....etc. Is there something special I have to do other than declaringthe chainID(137) when I'm transacting on Polygon network?

Anyone tell me what I'm doing wrong?

Jtara
  • 45
  • 5

1 Answers1

2

Ok, got it. You must set web3.TransactionManager.UseLegacyAsDefault = true and skip settings manually gas fee. Enjoy :-)

https://github.com/Nethereum/Nethereum/issues/750

Tomislav Stankovic
  • 3,080
  • 17
  • 35
  • 42