How to do fast mining for testing?

daboozdabooz Member Posts: 17
How does one configure the system to get fast (less than a minute) block mining times?

Apologies if this was asked already, but I could not find an answer in the forums. I posted here because I am using geth.

I have a private test net with 1 node. I have my own genesis block. I am writing and testing contracts, which includes deployment of the contract, which in turn requires a block to be mined with the contract Tx in it.

I am aware of https://chriseth.github.io/browser-solidity/ which helps a great deal to test the contract itself, but that's running outside a "real" environment. I would like to be able to test efficiently in a "real" test environment without having to wait for sometimes over 10 mins to mine a block.

thanks

Comments

  • analyzedizanalyzediz Member Posts: 1
    I wanna say that it depends on the difficulty of your genesis block. Here's a sample genesis block that I use to seed my test network

    { "nonce": "0xbigmoneynowhammy", "timestamp": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x634f727365", "gasLimit": "0x8000000", "difficulty": "0x400", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333", "alloc": { } }

    Hopefully that helps a bit.
  • daboozdabooz Member Posts: 17
    Thanks @analyzediz, I also have a genesis block with low difficulty, but still had long mining times. So, I did more experimentation and realized that my problem was infrastructural in nature. The net is that I was using a VM that was too small. When I switched to a VM with 4CPUs and 4 GB RAM, mining was very fast. I am now getting a new block every 15 secs in my test net.
Sign In or Register to comment.