4

I can't deploy my contract to Rinkeby network through truffle migrate --reset --network rinkeby.

My truffle.js file looks like this:

{ networks: { rinkeby: { { from : 'my_unlocked_and_non_empty_wallet_address', network_id : 4, gas : 2700000, gasPrice : 20000000000, host : "localhost", port : 8545 } } } }

Geth node is running inside Docker at the same host where I try to deploy. I've successfully connected to this node via truffle console.

When I run truffle migrate --reset --network rinkeby I have an error:

Running migration: 1_initial_migration.js Deploying Migrations... ... 0x076235e944e70e561a0b9b6b14307157d07775d67a46689e44ffaf7675829b84 /home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:30534 throw new Error('invalid address'); ^

Error: invalid address at inputAddressFormatter (/home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:30534:11) at /home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:36660:28 at Array.map (native) at Method.formatInput (/home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:36659:32) at Method.toPayload (/home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:36685:23) at Eth.send [as getCode] (/home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:36710:30) at Object.callback (/home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:241521:39) at /home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:36713:25 at /home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:243485:9 at /home/admin/.nvm/versions/node/v8.2.1/lib/node_modules/truffle/build/cli.bundled.js:78847:11

Contract creation transaction from output can be founded here: 0x076235e944e70e561a0b9b6b14307157d07775d67a46689e44ffaf7675829b84

There is a result of little debugging cli.bundled.js file.

This is what I get whe try to deploy in testrpc network:

... 0x34865735e70707919805f2850b823e67adb25ff0fe059d5ece5836d9430a7208 [ [Function: inputAddressFormatter], [Function: inputDefaultBlockNumberFormatter] ] [ '0x97280c75faa2e7e1b2a182e34fffcb77c58b9b56' ] Migrations: 0x97280c75faa2e7e1b2a182e34fffcb77c58b9b56

And in Rinkeby network:

... 0xa2a4697161936052f320bbce9171600741cf155785d25ecf45d914f1445be648 [ [Function: inputAddressFormatter], [Function: inputDefaultBlockNumberFormatter] ] [ null ]

As we can see, in the case of Rinkeby we have null instead of valid contract address. But... why has it happened?

Ok, I went deeper.

So, when executes this line (https://github.com/ethereum/web3.js/blob/7560f273359071afae31d010b97fa1872dacd66c/lib/web3/contract.js#L119) of web3.js code (line 222802 in Truffel's cli.bundled.js) we are getting answer with null in contractAddress field.

For example:

{ blockHash: '0xd08cee7ec0d9e50185099ca403b53798081f94ba73bbb9caa7a72fa2afb2591f', blockNumber: 696482, contractAddress: null, cumulativeGasUsed: 201492, from: '0xdc2e0c6e3d08bc53200ea0a90ec4f550d9d1f616', gasUsed: 0, logs: [], logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', root: '0x4ae760bf36bd646016db7018f16f6e5fadc2200aee17a89337b6d0a26534fb03', to: null, transactionHash: '0x6863a10cc9e42f62056f5defebd9f249ced92c024c1cb2ed94ae1a1efb1a5cc5', transactionIndex: 0 }

And example for testrpc which works properly:

{ transactionHash: '0x55bb0dc39488b897ced17831ff6308741045b463993d3b2d239748434b134b89', transactionIndex: 0, blockHash: '0xa04dc4a145b6884dfa78cfc4d55888b4e6c2ed41b8888cff72458728b474f6da', blockNumber: 15, gasUsed: 201262, cumulativeGasUsed: 201262, contractAddress: '0x0bfed93fdbcd00323918ad1d361cd999ba291ce4', logs: [] }

1

1 Answer 1

3

I've found the reason. contractAddress is null because I'm using geth node in embedded/light mode - it hasn't enough information about blockchain. Issue may be closed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.