libbitcoin

package module
v0.0.0-...-2068061 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2016 License: MIT Imports: 17 Imported by: 0

README

go-libbitcoinclient

Libbitcoin client library in Go

This library requires ZeroMQ version 4.0.1 or above with libsodium enabled.

Documentation

Index

Constants

View Source
const (
	HeartbeatPort    = 9092
	BlockPublishPort = 9093
)
View Source
const MAX_UNIT32 = 4294967295

Variables

View Source
var ErrorCodes map[int]error = make(map[int]error)

Functions

func ParseError

func ParseError(b []byte) error

Types

type ClientBase

type ClientBase struct {
	// contains filtered or unexported fields
}

func NewClientBase

func NewClientBase(address string, publicKey string) *ClientBase

func (*ClientBase) SendCommand

func (cb *ClientBase) SendCommand(command string, data []byte, callback func(interface{}, error))

type FetchHistory2Resp

type FetchHistory2Resp struct {
	IsSpend bool
	TxHash  string
	Index   uint32
	Height  uint32
	Value   uint64
}

type LibbitcoinClient

type LibbitcoinClient struct {
	*ClientBase
	ServerList  []Server
	ServerIndex int
	Params      *chaincfg.Params
	// contains filtered or unexported fields
}

func NewLibbitcoinClient

func NewLibbitcoinClient(servers []Server, params *chaincfg.Params) *LibbitcoinClient

func (*LibbitcoinClient) Broadcast

func (l *LibbitcoinClient) Broadcast(tx []byte, callback func(interface{}, error))

func (*LibbitcoinClient) FetchHistory2

func (l *LibbitcoinClient) FetchHistory2(address btc.Address, fromHeight uint32, callback func(interface{}, error))

func (*LibbitcoinClient) FetchLastHeight

func (l *LibbitcoinClient) FetchLastHeight(callback func(interface{}, error))

func (*LibbitcoinClient) FetchTransaction

func (l *LibbitcoinClient) FetchTransaction(txid string, callback func(interface{}, error))

func (*LibbitcoinClient) FetchUnconfirmedTransaction

func (l *LibbitcoinClient) FetchUnconfirmedTransaction(txid string, callback func(interface{}, error))

func (*LibbitcoinClient) ListenHeartbeat

func (l *LibbitcoinClient) ListenHeartbeat()

func (*LibbitcoinClient) Parse

func (l *LibbitcoinClient) Parse(command string, data []byte, callback func(interface{}, error))

func (*LibbitcoinClient) RenewSubscription

func (l *LibbitcoinClient) RenewSubscription(address btc.Address, callback func(interface{}))

func (*LibbitcoinClient) RotateServer

func (l *LibbitcoinClient) RotateServer()

func (*LibbitcoinClient) SubscribeAddress

func (l *LibbitcoinClient) SubscribeAddress(address btc.Address, callback func(interface{}))

func (*LibbitcoinClient) UnsubscribeAddress

func (l *LibbitcoinClient) UnsubscribeAddress(address btc.Address)

func (*LibbitcoinClient) Validate

func (l *LibbitcoinClient) Validate(tx []byte, callback func(interface{}, error))

type Response

type Response struct {
	// contains filtered or unexported fields
}

type Server

type Server struct {
	Url       string
	PublicKey string
}

type SubscribeResp

type SubscribeResp struct {
	Address string
	Height  uint32
	Block   string
	Tx      btcutil.Tx
}

type ZMQSocket

type ZMQSocket struct {
	// contains filtered or unexported fields
}

func NewSocket

func NewSocket(cb chan Response, socketType zmq.Type) *ZMQSocket

func (*ZMQSocket) ChangeEndpoint

func (s *ZMQSocket) ChangeEndpoint(current, newUrl, newPublicKey string)

func (*ZMQSocket) Close

func (s *ZMQSocket) Close()

func (*ZMQSocket) Connect

func (s *ZMQSocket) Connect(address, publicKey string) error

func (*ZMQSocket) Send

func (s *ZMQSocket) Send(data []byte, flag zmq.Flag)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL