Categorygithub.com/bruhanda/go-bitcoin
modulepackage
0.0.0-20240602165822-4f3f2627c708
Repository: https://github.com/bruhanda/go-bitcoin.git
Documentation: pkg.go.dev

# README

ZMQ It is also possible to subscribe to a bitcoin node and be notified about new transactions and new blocks via the node's ZMQ interface.

First, create a ZMQ instance:

zmq := bitcoin.NewZMQ("localhost", 28332) Then create a buffered or unbuffered channel of strings and a goroutine to consume the channel:

ch := make(chan string)

go func() {
	for c := range ch {
		log.Println(c)
	}
}()

Finally, subscribe to "hashblock" or "hashtx" topics passing in your channel:

err := zmq.Subscribe("hashblock", ch)
if err != nil {
	log.Fatalln(err)
}

# Functions

No description provided by the author
NewZMQ comment.
NewZMQWithRaw creates a bitcoin ZMQ listener with raw enabled.
NewZMQWithSubscribeOptionValue creates a bitcoin ZMQ listener with subscribe option value.

# Structs

No description provided by the author
No description provided by the author
ZMQ struct.