I am trying to perform a heavy load and scalability tests on a smart contract. However, the test takes a lot of time because only 1 transaction is added per block. I read that this might be due to gasLimit of the block but currently my blocks have a limit of 3877440195466 gas and the transaction that is processed take s "txs=1 gas=36544". I am wondering how can I fix that and also if there is a way to change my mining code so that more transactions are added per block?

  • What is your geth command line? Is your network PoA or PoW? What is your genesis file? A geth blockchain can be configured to generate blocks at a fixed interval of time instead of mining immediately. – Ismael Jan 30 '20 at 16:54
  • 1
    @Ismael It is a PoW chain. I believe I found what the problem is but I am not sure how to fix it. Basically, I am testing an ERC20 token and I am trying to perform 500 transactions in a truffle test and measure the time that it would take for all of them to be processed. I was using 'await contract.transfer(..)' for each transaction in order to measure how much time it took for the transaction to be deployed but await causes transactions to be processed 1 by 1. When I removed it , the blocks included multiple transactions but I dont know how to measure the execution time in this case – Aleksi Daskalov Jan 30 '20 at 17:13
  • 1
    Is it possible you are waiting for transaction confirmation before emitting the next transaction? That would indeed result in one transaction per block. – Rob Hitchens Jan 30 '20 at 19:32
  • @Rob Yeah I believe that's the problem. The problem is that I am not sure how I can get confirmation for transactions without await so that I can measure the time it takes for all of them to be processed – Aleksi Daskalov Jan 30 '20 at 20:22
  • You don't have to wait for confirmation to send the next one, although you should be prepared to deal with the failure case. This might be helpful (I like #2) or maybe skipping ahead too fast. ethereum.stackexchange.com/questions/39790/… – Rob Hitchens Jan 30 '20 at 23:09

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.