Recibo Error: Invalid JSON RPC response: undefined
de mi aplicación node.js cuando intenta ejecutar una función. mis pasos:
billetera ethereum 0.5.1 para implementar un contrato en la red de prueba.
inicie la versión 1.3.3 del cliente geth:
$ geth --rpc --rpcaddr "0.0.0.0" --rpcapi "eth,web3" --rpcport 8546 --networkid 5678 attach
(Puedo ejecutar web3.eth.accounts
desde la consola geth y me devuelve mis cuentas creadas localmente)
usó npm para instalar web3 versión 0.15.3
desde dentro del shell del nodo:
> 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)
También: $ telnet localhost 8546
no produce conexión
desde la consola geth:
admin.startRPC("127.0.0.1", 8545, "*", "web3,db,net,eth")
luego pude volver a conectarme en el nodo y enumerar las cuentas. (como era de esperar, telnet también respondió en este puerto después de iniciar RPC desde dentro de geth)
Tomado de aquí:
niksmac
eth.accounts
es indefinido; intente iniciar geth con--etherbase
la bandera junto con su dirección.Jaime B.
niksmac
Jaime B.
marcvander