miguelmota / ethereum-development-with-go-book

📖 A little guide book on Ethereum Development with Go (golang)
https://goethereumbook.org
Other
1.74k stars 427 forks source link

SubscribeFilterLogs: The method eth_logs does not exist/is not available #9

Closed thapakazi closed 6 years ago

thapakazi commented 6 years ago

Hello @miguelmota I am following up your awesome book. My requirement is to read the event log of a Transfer(from, to, value) function. I am using SubscribeFilterLogs for continuous log streaming and updating my other dbs.

But I am little bit stuck head over to this obfuscating error msg:

The method eth_logs does not exist/is not available

I have posted the issuse on slack:golang#ethereum room

I am quiet sure, error is pooping from this line: https://github.com/miguelmota/ethereum-development-with-go-book/blob/082005828d9647ac6ecd2684a340e55f7b91f692/code/event_subscribe.go#L21-L26

But couldn't figure out why though. The closest google match relation I found is on this thread: https://github.com/ethereum/go-ethereum/issues/310#issuecomment-75984471

Am I missing something import here. I have just started the websocket with admin.startWS("0.0.0.0", 8546, "*","*") , I am sure, I can telnet to that port.

/cc @miguelmota

miguelmota commented 6 years ago

@thapakazi is ws://127.0.0.1:8546 the url your ethclient is dialing to? If not try that

miguelmota commented 6 years ago

This should work

admin.startWS("0.0.0.0", 8546, "*")

or

admin.startWS("0.0.0.0", 8546, "*", "db,eth,net,web3,personal,web3")

Please reopen if having same issue

thapakazi commented 6 years ago

Yep it works, thanks. Lets document this somewhere :neckbeard: