2

I am trying to create multiple transactions between two accounts using SendTransactionAsync method. But I am getting "replacement transaction underpriced" message. I found some links which says we need to increase nonce to create new transactions in loop. But I am not able to find Nethereum function where I can mention nonce value while creating transaction. Can anybody guide me with solution to this?

HexBigInteger gas = new HexBigInteger(25000);
HexBigInteger value = new HexBigInteger(100);
for (int i = 0; i < 1000; i++)
{
  gas = new HexBigInteger(gas.Value + (gas.Value * 20) / 100);
  value = new HexBigInteger(value.Value + (value.Value * 20) / 100);
  var privateKey1 = "0x5083ff34a6610ad0d08d5e568fcee84e29a1391a6fffa8cf96484388f57de731";
  var account = new Account(privateKey1);
  var web3 = new Web3(account, "http://127.0.0.1:8001/", null, null);
  var addressTo = "0x12890D2cce102216644c59daE5baed380d84830c";
  string data = "ASDF";
  var transaction = await web3.TransactionManager.SendTransactionAsync(new TransactionInput(data.ToHexUTF8(), addressTo, account.Address,gas, value));
}
-1

Create your web3 instance outside loop and give a try

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.