4

I'm trying to create a private chain using parity (PoA) and truffle but when I do truffle migrate it hangs forever with the following output:

   > [
   >   {
   >     "jsonrpc": "2.0",
   >     "id": 24,
   >     "method": "eth_getFilterChanges",
   >     "params": [
   >       "0x0"
   >     ]
   >   }
   > ]
 <   [
 <     {
 <       "jsonrpc": "2.0",
 <       "result": [],
 <       "id": 24
 <     }
 <   ]  

Steps to Reproduce

Create a chain with the following custom_chain.json:

{
    "name": "DemoPoA",
    "engine": {
        "authorityRound": {
            "params": {
                "stepDuration": "5",
                "validators" : {
                    "list": [
                    ]
                }
            }
        }
    },
    "params": {
        "gasLimitBoundDivisor": "0x400",
        "maximumExtraDataSize": "0x20",
        "minGasLimit": "0x1388",
        "networkID" : "0x2323"
    },
    "genesis": {
        "seal": {
            "authorityRound": {
                "step": "0x0",
                "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
            }
        },
        "difficulty": "0x20000",
        "gasLimit": "0x5B8D80"
    },
    "accounts": {
        "0x0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
        "0x0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
        "0x0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
        "0x0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } }
    }
}

.. config file note0.toml:

[parity]
chain = "custom_chain.json"
base_path = "./"
[network]
port = 30300
[rpc]
port = 8540
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
[ui]
port = 8180
[websockets]
port = 8450

.. and command:

parity --config node0.toml

Then create two users:

curl --data '{"jsonrpc":"2.0","method":"parity_newAccountFromPhrase","params":["node0", "node0"],"id":0}' -H "Content-Typ e: application/json" -X POST localhost:8540

curl --data '{"jsonrpc":"2.0","method":"parity_newAccountFromPhrase","params":["user", "user"],"id":0}' -H "Content-Typ e: application/json" -X POST localhost:8540

.. and restart node with the following custom_chain.json:

{
    "name": "DemoPoA",
    "engine": {
        "authorityRound": {
            "params": {
                "stepDuration": "5",
                "validators" : {
                    "list": [
                        "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"
                    ]
                }
            }
        }
    },
    "params": {
        "gasLimitBoundDivisor": "0x400",
        "maximumExtraDataSize": "0x20",
        "minGasLimit": "0x1388",
        "networkID" : "0x2323"
    },
    "genesis": {
        "seal": {
            "authorityRound": {
                "step": "0x0",
                "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
            }
        },
        "difficulty": "0x20000",
        "gasLimit": "0x5B8D80"
    },
    "accounts": {
        "0x0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
        "0x0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
        "0x0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
        "0x0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
        "0x004ec07d2329997267Ec62b4166639513386F32E": { "balance": "10000000000000000000000" }
    }
}

.. node0.toml:

[parity]
chain = "custom_chain.json"
base_path = "./"
[network]
port = 30300
[rpc]
port = 8540
apis = ["web3", "eth", "net", "personal", "parity", "parity_set", "traces", "rpc", "parity_accounts"]
[ui]
port = 8180
[websockets]
port = 8450
[account]
password = ["node.pwds"]
[mining]
engine_signer = "0x00Bd138aBD70e2F00903268F3Db08f2D25677C9e"
reseal_on_txs = "none"

.. node.pwds:

node0

.. and command:

parity --config node0.toml

Then unlock user account:

curl --data '{"method":"personal_unlockAccount","params":["0x004ec07d2329997267Ec62b4166639513386F32E","user",null],"id": 1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8540

And try to connect with truffle compile && truffle migrate with the following truffle.js file:

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8540,
      network_id: "0x2323",
      from: "0x004ec07d2329997267Ec62b4166639513386F32E"
    }
  }
};

Expected Behavior

truffle does the initial migration

Actual Results

Hangs forever.

Environment

  • Operating System: Windows 10
  • Ethereum client: parity1.9.4
  • Truffle version (truffle version): 4.3.1
  • node version (node --version): 8.1.3
  • npm version (npm --version): 4.1.1

P.S. I had similar problem with geth but there I attached to IPC socket and called miner.start() - it helped. Here there is no miner object as there is no PoW (I'm trying to use and need PoA for my dapp).

  • did u found an answer what a problem was? – DeV1doR Jun 30 '18 at 0:25
  • @DeV1doR Eventually I switched to using Hyperledger Fabric as I didn't want to mine eth, I just wanted to create a dapp on top of a private network – Dmitry Senkovich Jul 2 '18 at 13:58
0

https://gist.github.com/Godtide/1a84c98d1dc7ec434672bed17f3dd09c

For more clarification.

/*
 * NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a
 * function when declaring them. Failure to do so will cause commands to hang. ex:
 * ```
 * mainnet: {
 *     provider: function() {
 *       return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/<infura-key>')
 *     },
 *     network_id: '1',
 *     gas: 4500000,
 *     gasPrice: 10000000000,
 *   },
 */

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.