-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Question] How to watch blocks like viem.watchBlocks? #2095
Comments
bitcoinjs don`t support watchBlocks You can use service from mempool:https://mempool.space/signet/docs/api/websocket |
Thank you so much for your response, @jasonandjay. I was looking more for a connection with an own bitcoin node for cheaper costs because I'm bootstrapping the project right now. I'm running a Chainstack Bitcoin node but can't connect with the |
I'm sorry that I can't help you. |
This comment was marked as spam.
This comment was marked as spam.
@mlopezpollux Sorry I dropped this. You can connect to your Bitcoin Core node via ZeroMQ and receive notices for new blocks. However, these messages are only the blockhash, so you will need to respond to those messages by querying the JSON-RPC getblock endpoint to get the full block details. getblock has a verbose option that will give you the full block as a JSON or I think you can also just get the full block and parse it yourself. (BitcoinJS-lib would be a good way to parse the raw block into (Edit: ZeroMQ has a ZeroMQ info: https://github.com/bitcoin/bitcoin/blob/v27.1/doc/zmq.md#usage JSON-RPC info: https://developer.bitcoin.org/reference/rpc/getblock.html |
Hey, guys! How is it going? Hope you are doing well :)
I'm making a monitoring server for deposits in different chains and I encountered that in EVM chains is really easy with viem's
watchBlocks
method but I'm not really sure what is the parallel in the bitcoin network.Please and thank you so much!
The text was updated successfully, but these errors were encountered: