Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new blockheader subscriber over websocket #13

Open
gitloverr opened this issue Aug 10, 2021 · 2 comments
Open

new blockheader subscriber over websocket #13

gitloverr opened this issue Aug 10, 2021 · 2 comments

Comments

@gitloverr
Copy link

hi everyone,

Is there any way I can listen to the last block header or block number over websocket? I couldn't find anything in your supported methods?

I tried this:

{"id": 1, "method": "eth_subscribe", "params": ["newHeads", {}]}

but I got this error:

{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"no "newHeads" subscription in eth namespace"}}

what should I do?

thank you

@jieyilong
Copy link
Member

The eth_subscribe method is not supported yet. Here are the methods that are currently supported:

https://github.com/thetatoken/theta-eth-rpc-adaptor#rpc-apis

@jieyilong
Copy link
Member

For now, one workaround is to call eth_blockNumber every 6 seconds (the block interval is roughly 6 seconds), and then call eth_getBlockByNumber to get the details of the newly added block(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@jieyilong @gitloverr and others