1

Using the dev private development chain in Parity works well for testing out generic contract interactions, since transactions are mined instantly in a pretty slick manner. But, I'm trying to test a contract interaction that waits a number of blocks (time-locked deposits).

The only way I can see to advance blocks in the dev chain is to just send ether transactions back and forth between the testnet accounts. But that's rather tedious to try and get a bunch of blocks added to the chain.

Is there a way to add several empty blocks to the Parity dev chain all at once, or do I have to make a bunch of manual transactions to simulate the blockchain growing?

  • This doesn't answer your question but if you're trying to test your contract, you might like to consider using pyethereum for testing. You can simulate a blockchain in memory, mine blocks, mess with timestamps etc and run your tests against the simulated blockchain in all the different states you need to cover. – Edmund Edgar Aug 27 '17 at 7:37
2

Just small hint you can automate this manual process of creating blocks. Key is to use --unlock and --password options when running parity so you have one unlocked account.

Then create simple script that will transfer some eth from unlocked account every x seconds.

For example in js its something like this

const Web3 = require("web3");
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

const src = "0x123...";
const dest = "0x456...";

setInterval( () => {
  web3.eth.sendTransaction({from:src, to:dest, value: web3.toWei(1, "ether")});
}, 12000);
0

The development chain accepts any block you give it.

Just get ethminer and run it on CPU and it should create valid blocks for your development chain. You might have to run Parity with the --author flag to enable mining though.

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.