I'm getting Error: Invalid JSON RPC response: undefined from my node.js application when it tries to execute a function.
My steps:
ethereum wallet 0.5.1 to deploy a contract to the testnet.
start the geth client version 1.3.3:
$ geth --rpc --rpcaddr "0.0.0.0" --rpcapi "eth,web3" --rpcport 8546 --networkid 5678 attach
(I can run web3.eth.accounts from within the geth console and it returns my locally created accounts)
used npm to install web3 version 0.15.3
from within the node shell:
> var Web3 = require('web3') > web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8546")) > web3.version.api '0.15.3' > web3.eth.accounts Error: Invalid JSON RPC response: undefined at Object.module.exports.InvalidResponse (/Users/jbowkett/node_modules/web3/lib/web3/errors.js:35:16) at HttpProvider.send (/Users/jbowkett/node_modules/web3/lib/web3/httpprovider.js:87:22) at RequestManager.send (/Users/jbowkett/node_modules/web3/lib/web3/requestmanager.js:58:32) at Eth.get [as accounts] (/Users/jbowkett/node_modules/web3/lib/web3/property.js:107:62) at repl:1:9 at REPLServer.defaultEval (repl.js:252:27) at bound (domain.js:287:14) at REPLServer.runBound [as eval] (domain.js:300:12) at REPLServer.<anonymous> (repl.js:417:12) at emitOne (events.js:82:20)
Also :
$ telnet localhost 8546
yields no connection
eth.accountsis undefined; try start geth with--etherbaseflag along with your address. – niksmac Mar 15 '16 at 13:54