i try to simulate a large transaction load and therefore want to execute multiple transactions in a truffle test. I changed the block-time to five seconds and generate the transactions, but only one transaction per block is executed.

Here is my code: enter image description here

And here the ganache blocks. Every block with only one transaction, i would like to have all 10 transactions in a single block.

enter image description here

I really need help, i dont understand the problem. I am able to get two transactions in a block when i manually send ether with metamask, but not with the truffle test.

EDIT - solved: I changed the code to web3.eth.Contract and call the method with Contract.methods.myFunction(..), now it works but i dont know why ^^: enter image description here

  • That configuration should be supported by ganache. What does your configuration look like? Did you restart the ganache instance? – Ismael Sep 27 '20 at 3:37
  • var truffleConfig = { networks: { development: { host: '', port: 7545, network_id: "*", websockets: true } } }; – Darigas Sep 27 '20 at 13:47
  • but i think the truffle code is the problem – Darigas Sep 27 '20 at 13:47
  • Default ganache config only accepts 1 transaction per block, if you changed it and restarted it should accept more than one. Truffle should just work without any change, but it depends on the test if you await then the 5 seconds will elapse and a block will be created anyway. In your test you are not waiting for the transaction, the 2 seconds timeout might pass before they are mined, you have to use something like Promise.all to wait for all transactions. – Ismael Sep 27 '20 at 14:57
  • 1
    ganache was not the problem, something with my truffle code was wrong, but i found a workaround – Darigas Sep 27 '20 at 18:15

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.