I've started up a local node (an avalanche node) and I've successfully connected to it using geth.
❯❯❯ geth attach http://127.0.0.1:65130/ext/bc/C/rpc
Welcome to the Geth JavaScript console!
instance: v0.8.4-rc.3
coinbase: 0x0100000000000000000000000000000000000000
at block: 0 (Wed Dec 31 1969 18:00:00 GMT-0600 (CST))
modules: eth:1.0 net:1.0 rpc:1.0 web3:1.0
I'd like to subscribe to events on this node. The geth docs mention that this should be possible by sending json through the console. When I try to send this json, I get complaints about the json formatting:
> {"id": 1, "method": "eth_subscribe", "params": ["newHeads", {}]}
SyntaxError: SyntaxError: (anonymous): Line 1:6 Unexpected token : (and 2 more errors)
even though I copied this json directly from the docs (and it seems well formed to me).
The docs also mention that I need a minimum version of 1.4 and I have version 1.10:
❯❯❯ geth version
Geth
Version: 1.10.16-stable
Architecture: amd64
Go Version: go1.17.6
Operating System: darwin
GOPATH=
GOROOT=go
How can I use geth to subscribe to events?