1

Issue

I ran the official example code: truffle migrate,and stuck there for a long long time:

truffle migrate

Running migration: 1_initial_migration.js
Deploying Migrations...

Steps to Reproduce

I started my geth using command:

geth --port 3000 --networkid 58343 --nodiscover --datadir=./datadir --maxpeers=0  --rpc --rpcport 8543 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner"

myGenesis.json

{
"config": {
"chainId": 16,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0
},
"difficulty": "400",
"gasLimit": "2000000",
"alloc": {
"f953e0323e6ef6fabe74a2a16ca633cdf512203a":{
"balance":"1000000000000000000000000"
}
}
} 

truffle.js

module.exports = {
rpc: {
host:"localhost",
port:8543
},
networks: {
development: {
host: "localhost", //our network is running on localhost
port: 8543, // port where your blockchain is running
network_id: "*",
from: "0xf953e0323e6ef6fabe74a2a16ca633cdf512203a", // use the 
account-id generated during the setup process
gas: 1900000
        }
    }
};

Note: I unlocked the 0th account from geth console and did start mining at the time of deploying . I checked the statuus using personal.listWallets() and found that rest all accounts are locked except the first one.

Expected Behavior

Truffle migration should be have completed succeesfully

Actual Results

Then I redeployed and I got this output Using network 'development'.

`Running migration: 1_initial_migration.js
 Deploying Migrations... 
 0x313ee101eb7b3f3e9eb49c08a3d45b926e68ff3c55f3f5bdc7b0359be75f5bef
 Migrations: 0x61ccc18e4e1e66086c0e9ceea8e45471b471d7f5
 Saving successful migration to network...
 ... undefined
 Error encountered, bailing. Network state unknown. Review successful 
 transactions manually.
 Error: authentication needed: password or unlock
 at Object.InvalidResponse (/usr/local/share/packages/node-v8.9.4-
 linux-x64/ lib/node_modules/truffle/ 
 build/webpack:/~/web3/lib/web3/errors.js:38:1)
 at /usr/local/share/packages/node-v8.9.4-linux-
 x64/lib/node_modules/truffle/build 
 /webpack:/~/web3/lib/web3/requestmanager.js:86:1
 at /usr/local/share/packages/node-v8.9.4-linux-
 x64/lib/node_modules/truffle/build/webpack:/packages/truffle-
 migrate/index.js:225:1
at /usr/local/share/packages/node-v8.9.4-linux-x64/lib/node_modules/truffle/build/webpack:/packages/truffle-provider/wrapper.js:134:1
at XMLHttpRequest.request.onreadystatechange (/usr/local/share/packages/node-v8.9.4-linux-x64/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/share/packages/node-v8.9.4-linux-x64/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
at XMLHttpRequest._setReadyState (/usr/local/share/packages/node-v8.9.4-linux-x64/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/share/packages/node-v8.9.4-linux-x64/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
at IncomingMessage.<anonymous> (/usr/local/share/packages/node-v8.9.4-linux-x64/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

Environment

  • Operating System: Ubuntu
  • Ethereum client: Geth 1.8.14-stable-316fc7ec
  • Truffle version (truffle version): v4.1.14 (core: 4.1.14)
  • node version (node --version):v8.9.4
  • npm version (npm --version): 5.6.0

1 Answer 1

0

The issue is that you are not signing your transaction. After it hasn't been signed for a long time, you are getting that error.

Since you are using Geth and pointing to your localhost, you must unlock your account that is sending the transaction before you run truffle migrate. This can be done by using the flags geth --unlock <YOUR_ACCOUNT_ADDRESS> --password <YOUR_PASSWORD>.

2
  • 1
    I had unlocked my account using command: personal.unlockAccount(eth.accounts[0]) before truffle migrate, still was getting this error. The issue is that you are not signing your transaction. After it hasn't been signed for a long time, you are getting that error. - Not clear about this though. Am I missing something here ? Oct 20, 2018 at 19:22
  • From the documentation personal.unlockaccount the account is unlocked for 5 minutes after that you have to unlock again. You can use 0 as duration to unlock until you quit geth.
    – Ismael
    Oct 22, 2018 at 21:33

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.