blockchain

package
v4.14.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: Apache-2.0 Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	BlockHeight int `json:"block_height"`
}

Header is returned by HeadersSubscribe().

type Interface

type Interface interface {
	ScriptHashGetHistory(ScriptHashHex, func(TxHistory) error, func(error))
	TransactionGet(chainhash.Hash, func(*wire.MsgTx) error, func(error))
	ScriptHashSubscribe(func() func(error), ScriptHashHex, func(string) error)
	HeadersSubscribe(func() func(error), func(*Header) error)
	TransactionBroadcast(*wire.MsgTx) error
	RelayFee(func(btcutil.Amount), func(error))
	EstimateFee(int, func(*btcutil.Amount) error, func(error))
	Headers(int, int, func([]*wire.BlockHeader, int) error, func(error))
	GetMerkle(chainhash.Hash, int, func(merkle []TXHash, pos int) error, func(error))
	Close()
	ConnectionStatus() Status
	RegisterOnConnectionStatusChangedEvent(func(Status))
}

Interface is the interface to a blockchain index backend. Currently geared to Electrum, though other backends can implement the same interface.

type ScriptHashHex

type ScriptHashHex string

ScriptHashHex is the hash of a pkScript in reverse hex format.

type Status

type Status int

Status is the connection status to the blockchain node

const (
	// CONNECTED indicates that we are online
	CONNECTED Status = iota
	// DISCONNECTED indicates that we are offline
	DISCONNECTED
)

type TXHash

type TXHash chainhash.Hash

TXHash wraps chainhash.Hash for json deserialization.

func (*TXHash) Hash

func (txHash *TXHash) Hash() chainhash.Hash

Hash returns the wrapped hash.

func (*TXHash) MarshalJSON

func (txHash *TXHash) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*TXHash) UnmarshalJSON

func (txHash *TXHash) UnmarshalJSON(jsonBytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type TxHistory

type TxHistory []*TxInfo

TxHistory is returned by ScriptHashGetHistory.

func (TxHistory) Status

func (history TxHistory) Status() string

Status encodes the status of the address history as a hash, according to the Electrum specification. https://github.com/kyuupichan/electrumx/blob/b01139bb93a7b0cfbd45b64e170223f4871a4a87/docs/PROTOCOL.rst#blockchainaddresssubscribe

type TxInfo

type TxInfo struct {
	Height int    `json:"height"`
	TXHash TXHash `json:"tx_hash"`
	Fee    *int64 `json:"fee"`
}

TxInfo is returned by ScriptHashGetHistory.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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