[Ethereum] Parity mining on –chain dev for truffle migrate

miningparitytestnetstruffle

I am using Parity to create a custom app and so I am using it locally on –dev. "$ truffle migrate" fails, I think because there is no balance in the account. It says:

Error: Insufficient funds. The account you tried to send transaction from does not
have enough funds. Required 471238800000000000 and got: 0.

But using –dev, this shouldn't be a problem, right? The transactions should work without being mined first? Or something like that?

I tried running genoil but (a) I don't think I need to on –dev and (b) it won't run on a VPS with no GPU anyway.

I tried attaching to Parity with geth attach and it connects (because eth.coinbase returns the correct address) but that user has 0 balance. Also, miner.start() says:

ReferenceError: 'miner' is not defined
    at :1:1

I am invoking parity with:

$ /path/to/parity --geth --chain dev --dapps-hosts="all" --dapps-apis-all --jsonrpc-hosts="all" --unlock 0x... --password DevUserPass.txt --author ...

I have tried the "–author" flag with 0x as well, with the same result.


So I have a few related questions:

1 – What is your understanding of how the –chain dev option means you do NOT have to mine with parity? The docs aren't really clear.

2 – If I do need to mine (like I use another testnet), how can I do that on a VPS?

3 – Is it possible that truffle needs to be told to use the –chain dev mining technique? Like, it behaves different from a normal balance so has to be stated somewhere?

Best Answer

You can't mine a dev chain on Parity because it does not run a Proof-of-Work engine. Instead, it runs InstantSeal which basically just creates a new block every 2 seconds if there are transactions available.

The dev chain is preloaded with an insane amount of development Ether. Just open your wallet, go to Accounts, click the Add Account button and then Recovery and then without entering anything, click OK.

You can also run with --jsonrpc-api parity_accounts and issue the following call in another terminal:

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"parity_newAccountFromPhrase","params":["","password"],"id": 1}' localhost:8545

The trick is the account which can be recovered using an empty recovery phrase holds all the available tokens. This should be enough to get you started.

Read more on the configuration here: Private-development-chain; Read more on the engine here: Consensus-Engines

Related Topic