Provides a pure Go electrum protocol client implementation.
Features include:
- Simple to use
- Subscriptions are managed via channels and context
- Full TCP and TSL support
- Safe for concurrent execution
// Start a new client instance
client, _ := electrum.New(&electrum.Options{
Address: "node.xbt.eu:50002",
KeepAlive: true,
})
// Execute synchronous operation
version, _ := client.ServerVersion()
// Start a subscription, will terminate automatically after 30 seconds
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
defer cancel()
headers, _ := client.NotifyBlockHeaders(ctx)
for header := range headers {
// Use header
}
// Finish client execution
client.Close()