1

I am running a geth node and tried to perform a load testing by giving multiple transactions (1000 tx) from front end.

As the application is not crypto related and need the blocks to be mined faster, the console.go file is tweaked so that the block difficulty is always set to 1. Our case is not a crypto oriented and hence we have made the minimum gas price as 1.

Please check and help me on it.

More details as below

System information Geth Version: 1.8.18-unstable Git Commit: 3e1cfba Architecture: amd64 Protocol Versions: [63 62] Network Id: 1 Go Version: go1.11.1 Operating System: linux

Expected behaviour Expected behavior is for the tx to get mined.

Actual behaviour I am able to push in 1000 Tx, from front end, all the transactions are only sending 1 wei from account1 to account2. I increased nonce for the tx correctly and so there is no issue and all 1000 tx are created successfully.

I see the tx are struck in pending when viewed with web3.txpool

Steps to reproduce the behaviour Below is the Nethereum code used to create the 1000 tx. All the tx are created but waiting in pending queue.

        for (int i = 0; i < 1000; i++)
        {
            string data = "Test string";    
            var gasPrice = 10+i;
            var privateKey = "XXXXXXXXXXXXXXX";
            var senderAddress = "0xa5a85c234bca3D4BF29f7Bd7AD7D458dea8Ea8E9";
            var receiveAddress = "0x1b55195c2610f7c0069cb89db1b3e973ff447a49";

            var txCount = await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(senderAddress);
            var nonce = txCount.Value+i;
            var value = 1;
            var encoded = Web3.OfflineTransactionSigner.SignTransaction(privateKey, receiveAddress, value, nonce, gasPrice, 100000, data.ToHexUTF8());

            Debug.WriteLine(Web3.OfflineTransactionSigner.GetSenderAddress(encoded));
            Debug.WriteLine(encoded);

            var txId = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + encoded);
            var receipt = await web3.Eth.Transactions.GetTransactionByHash.SendRequestAsync(txId);

}

PS: When I worked with 10 tx(before trying with 1000 tx) for the same above code, it worked fine and the tx are mined immediately.

  • I'd check if you have enough balance to pay for the transactions, the nonce has to be consecutive numbers, check miner is working, try with less transactions – Ismael Nov 11 '18 at 3:51
  • @Ismael I have checked the nonce order and its fine, this is in test net and there is enough amount of balance to pay for all the 1000 tx, miner is working fine and the blocks are being created. I also tried with less number of tx and details as following 10 Tx - mined immediately 100 -Tx mined in 7 to 8 min 500 - Tx --> not being picked for mining at all and if we do any other transaction after this, all of them are going to pending queue and are not picked for mining – Manoj Kumar Nov 12 '18 at 5:22
  • That it is really odd, try adding verbosity flag to geth perhaps you are reaching some internal limit. – Ismael Nov 12 '18 at 6:14
  • @Ismael, I have started geth with verbosity as 5 and I don't see any limit issue. I found "Reinjecting stale transactions count=0" in the mining process, but I see there are 1000 tx pending in my chain and I can see them in web3.txpool. Any thoughts on this – Manoj Kumar Nov 13 '18 at 6:46
  • I remember last year I tried with 500 tx in a private testnet and they were mined quickly (less than 1 minute, without modifying geth). Perhaps there's something missing in your modification or the genesis parameters are not good, also it is possible something changed in geth in between. – Ismael Nov 13 '18 at 16:32
1

Use below genisis config & don't modify geth config, use default settings. It will work.

{
  "config": {
    "chainId": 33,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  },
  "nonce": "0x0000000000000033",
  "timestamp": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0x8000000",
  "difficulty": "0x100",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x3333333333333333333333333333333333333333",
  "alloc": {}
}

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.