Im using web3.js to retrieve the balance for the main account on my geth server
I set:
let provider = new web3.providers.HttpProvider(ethereumNode)
web3.setProvider(provider)
if (!web3.isConnected()) {
console.error('Ethereum - no conection to RPC server')
} else {
// is connected
console.log('Ethereum - connected to RPC server')
}
web3.eth.defaultAccount = from // from is my account on geth
// When goes to this line I get Error: invalid address
console.log("balance ", web3.eth.getBalance())
Besides this, I m trying to broadcast a raw transaction where it gets the same error
Error: invalid address
however If I run the same raw transaction on https://ropsten.etherscan.io/pushTx it works fine.
any ideas what is happening? I have the feeling is a problem on my geth server.
error stack on getBalance()
Error: invalid address
at inputAddressFormatter (.../node_modules/web3/lib/web3/formatters.js:271:11)
at .../node_modules/web3/lib/web3/method.js:89:28
at Array.map (native)
at Method.formatInput (.../node_modules/web3/lib/web3/method.js:88:32)
at Method.toPayload (.../node_modules/web3/lib/web3/method.js:114:23)
at Eth.send [as getBalance] (.../node_modules/web3/lib/web3/method.js:139:30)
at .../server/src/batches/export2contract.js:80:40
at writeContract (.../server/src/batches/export2contract.js:61:10)
at .../server/src/batches/export2contract.js:190:5
at Array.forEach (native)
Error stack on sendTransaction:
Error: invalid address
at inputAddressFormatter (.../node_modules/web3/lib/web3/formatters.js:271:11)
at inputTransactionFormatter (.../node_modules/web3/lib/web3/formatters.js:97:20)
at .../node_modules/web3/lib/web3/method.js:89:28
at Array.map (native)
at Method.formatInput (.../node_modules/web3/lib/web3/method.js:88:32)
at Method.toPayload (.../node_modules/web3/lib/web3/method.js:114:23)
at Eth.send [as sendTransaction] (.../node_modules/web3/lib/web3/method.js:139:30)
at .../server/src/batches/export2contract.js:135:32
at writeContract (.../server/src/batches/export2contract.js:61:10)
at .../server/src/batches/export2contract.js:190:5