This repository is a fork of d4l3k/go-electrum that is unmaintained now.
A pure Go Electrum bitcoin library. This makes it easy to write bitcoin based services using Go without having to run a full bitcoin node.
This is very much WIP and has a number of unimplemented methods. This will eventually be rewritten into a more Go-esque library and handle wallet generation.
Packages provided
- electrum - Library for using JSON-RPC to talk directly to Electrum servers.
- irc - A helper module for finding electrum servers using the #electrum IRC channel on Freenode. Notice: not supported.
See example/ for more.
$ go get -u github.com/copernet/go-electrum/electrum
package main
import (
"log"
"github.com/copernet/go-electrum/electrum"
)
func main() {
// turn on debug mode
electrum.DebugMode = true
node := electrum.NewNode()
// the specified ip is testnet server
if err := node.ConnectTCP("39.104.125.149:9629"); err != nil {
log.Fatal(err)
}
// please use bitcoin address accordant to the server environment
balance, err := node.BlockchainAddressGetBalance("n4FyJMDYXJmPEm7cffFLrwLXvGWn8cW9q2")
if err != nil {
log.Fatal(err)
}
log.Printf("Address balance: %+v", balance)
}
go-electrum is licensed under the MIT license.
Made by Tristan Rice.