-
Notifications
You must be signed in to change notification settings - Fork 733
Closed
Description
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)
- 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. - Account created with chainId
new Account(privatekey, chain.Id)
- Web3 Interface created with RpcURL
new Web3(account, chain.RpcUrl)
- Polygon RPC which i'am using is official
Polygon-RPC
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
Labels
No labels