Joe
Joe

Reputation: 321

Using meteor HTTP to connect to ethereum node

I am trying to copy the following curl command using meteor HTTP

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' http://localhost:8545

The command is from here

This is what I tried:

HTTP.call('POST',"http://localhost:8545",{data:{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}},function(res,error){console.log(res)})

but it returns null. The curl command gives {"jsonrpc":"2.0","id":83,"result":"(the blocknumber)"}

Upvotes: 0

Views: 67

Answers (1)

iiro
iiro

Reputation: 3118

You have to swap error and res params.

HTTP.call('POST',"http://localhost:8545",{data:{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}},function(error, res){console.log(res)})

Upvotes: 1

Related Questions