0

In order to test the TPS of a private network, I have a script that signs and submits 400 transactions which sends ETH from one account to another account.

This network has it's block gas limit set to a large number 100000000

When I try to send 200 transactions as quickly as possible, all 200 transactions appear as pending on Ethstats, which then gets mined as expected. The Nodejs script outputs all 200 transaction hashes.

Problem: When I increase to sending 250 transactions, I only see 206 pending transactions waiting to be mined. The Nodejs script now starts to show several errors among about 200 transaction hashes.

Error: Invalid JSON RPC response: ""

Sometimes the error changes to

Returned error: known transaction: 1851b8b201bddc8e14ae2be19846b394203f5d7685ec148b1fa50d4afd065918

Does geth limit the number of pending transactions to 200? If so, is there a way to change this limit?

geth 1.8.13-unstable-2e0391ea was started using

--networkid 1337 --cache 512 --port 30303 --maxpeers 50 --rpc --rpcaddr "0.0.0.0" --rpcapi "eth, personal, web3" --ethstats "id:pass@ip:port" --bootnodes enode://id@ip:port

Tried doubling the default values but the geth node still cause web3 to throw errors to prevent more than 206 pending transactions.

geth --networkid 1337 --cache 2048 --txpool.accountslots 64 --txpool.globalslots 8192 --txpool.accountqueue 128 --txpool.globalqueue 2048 --port 30303 --maxpeers 50 --rpc --rpcaddr "0.0.0.0" --rpcapi "eth, personal, web3" --ethstats "id:pass@ip:port" --bootnodes enode://id@ip:port

Running geth with --verbosity 5, I notice that when sending over 200 transactions, geth ouputs messages such as

geth_1  | TRACE[07-18|14:35:14.521] Removed old pending transaction          hash=2554ac…358dfe
geth_1  | TRACE[07-18|14:35:14.522] Removed old pending transaction          hash=2442f8…aff68f
geth_1  | TRACE[07-18|14:35:14.522] Removed old pending transaction          hash=011f0d…be57e3
geth_1  | TRACE[07-18|14:35:14.523] Removed old pending transaction          hash=8329c0…b7ce6f
geth_1  | TRACE[07-18|14:35:14.528] Removed old pending transaction          hash=5ca395…f49895
geth_1  | TRACE[07-18|14:35:14.528] Removed old pending transaction          hash=75a77e…3a5088
geth_1  | TRACE[07-18|14:35:14.993] Pooled new future transaction            hash=1b4127…98667c from=0x96FF18B5356253ADD8BCE046111DAfb889Ca0E24 to=0xC311C779990d36309F529EE0ecb536C64115583c
geth_1  | INFO [07-18|14:35:14.993] Submitted transaction                    fullhash=0x1b41278d7cb16f5d285beec9c498ac402f15b290056fcd63d8bc5ad12298667c recipient=0xC311C779990d36309F529EE0ecb536C64115583c
geth_1  | TRACE[07-18|14:35:14.999] Pooled new future transaction            hash=39d48a…2f9a76 from=0x96FF18B5356253ADD8BCE046111DAfb889Ca0E24 to=0xC311C779990d36309F529EE0ecb536C64115583c
geth_1  | INFO [07-18|14:35:15.000] Submitted transaction                    fullhash=0x

and

geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=a16a65…1fec50
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=d7e4ad…e43037
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=a991bd…cf5812
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=531aa2…736a61
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=13d084…c6dda4
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=9f4cac…bdfde8
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=20b65d…af55db
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=da00d5…89b971
geth_1  | TRACE[07-18|14:44:18.925] Discarding already known transaction     hash=c3c2c9…3a22a6

test.js

var key = new Buffer('MyPrivateKey', 'hex')
var receivingAddr = '0xMyReceivingAddress';
var txValue = web3.utils.numberToHex(web3.utils.toWei('0.1', 'ether'));
var txData = web3.utils.asciiToHex('0x');
var nonce = await web3.eth.getTransactionCount(accountAddress)
var gasPriceHex = web3.utils.numberToHex(21000000000)   // original 21 gwei
var gasLimitHex = web3.utils.numberToHex(22000)        // original 22000 Wei
console.log('Starting nonce: ', nonce)

for (var i = nonce; i < nonce + 300; i++) {
    nounce = web3.utils.numberToHex(nonce)
    console.log('Nonce:', i)
    var rawTx = {
        nonce: i, 
        gasPrice: gasPriceHex,
        gasLimit: gasLimitHex,
        to: receivingAddr,
        value: txValue,
        data: txData 
    }

    var tx = new Tx(rawTx);
    tx.sign(key);
    var serializedTx = tx.serialize();

    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'), function(err, txhash) {
        if(err) console.log(err)
        else console.log(txhash)
    });
}

geth runs in a docker container with the Dockerfile:

FROM ubuntu:18.04

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --yes software-properties-common
RUN add-apt-repository ppa:ethereum/ethereum
RUN apt-get update && apt-get install --yes geth

COPY genesis.json genesis.json

RUN geth init genesis.json

ENTRYPOINT bash

Your Answer

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

Browse other questions tagged or ask your own question.