Documentation ¶
Index ¶
- Variables
- type APIErr
- type Balance
- type BlockchainHeader
- type GetTransaction
- type Node
- func (n *Node) BlockchainAddressGetBalance(address string) (*Balance, error)
- func (n *Node) BlockchainAddressGetHistory(address string) ([]*Transaction, error)
- func (n *Node) BlockchainAddressGetMempool() error
- func (n *Node) BlockchainAddressListUnspent(address string) ([]*Transaction, error)
- func (n *Node) BlockchainAddressSubscribe(address string) (<-chan string, error)
- func (n *Node) BlockchainBlockGetChunk(index int32) (string, error)
- func (n *Node) BlockchainBlockGetHeader(height int32) error
- func (n *Node) BlockchainEstimateFee(block int) (float64, error)
- func (n *Node) BlockchainHeadersSubscribe() (<-chan *BlockchainHeader, error)
- func (n *Node) BlockchainRelayfee() error
- func (n *Node) BlockchainScripthashGetBalance(scriptHash string) (*Balance, error)
- func (n *Node) BlockchainScripthashGetHistory(scriptHash string) ([]*Transaction, error)
- func (n *Node) BlockchainScripthashGetMempool(scriptHash string) error
- func (n *Node) BlockchainScripthashListUnspent(scriptHash string) ([]*Transaction, error)
- func (n *Node) BlockchainScripthashSubscribe(scriptHash string) (<-chan string, error)
- func (n *Node) BlockchainTransactionBroadcast(tx string) (interface{}, error)
- func (n *Node) BlockchainTransactionGet(txid string, verbose bool) (*GetTransaction, error)
- func (n *Node) BlockchainTransactionGetMerkle() error
- func (n *Node) ConnectSSL(addr string, config *tls.Config) error
- func (n *Node) ConnectTCP(addr string) error
- func (n *Node) Disconnect()
- func (n *Node) Ping() error
- func (n *Node) ServerAddPeer() error
- func (n *Node) ServerBanner() (string, error)
- func (n *Node) ServerDonationAddress() (string, error)
- func (n *Node) ServerFeatures() error
- func (n *Node) ServerPeersSubscribe() ([][]interface{}, error)
- func (n *Node) ServerVersion() ([]string, error)
- type ScriptPubKeyResult
- type ScriptSig
- type TCPTransport
- type Transaction
- type Transport
- type Vin
- type Vout
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotImplemented = errors.New("not implemented") ErrNodeConnected = errors.New("node already connected") ErrNodeShutdown = errors.New("node has shutdown") ErrTimeout = errors.New("request timeout") )
var DebugMode bool
Functions ¶
This section is empty.
Types ¶
type BlockchainHeader ¶
type BlockchainHeader struct { Nonce uint32 `json:"nonce"` PrevBlockHash string `json:"prev_block_hash"` Timestamp int64 `json:"timestamp"` MerkleRoot string `json:"merkle_root"` BlockHeight int32 `json:"block_height"` UtxoRoot string `json:"utxo_root"` Version int32 `json:"version"` Bits int64 `json:"bits"` }
type GetTransaction ¶
type GetTransaction struct { Hex string `json:"hex"` Txid string `json:"txid"` Version int32 `json:"version"` Locktime uint32 `json:"locktime"` Vin []Vin `json:"vin"` Vout []Vout `json:"vout"` BlockHash string `json:"blockhash"` Confirmations int32 `json:"confirmations"` Time int64 `json:"time"` Blocktime int64 `json:"blocktime"` }
type Node ¶
type Node struct { Error chan error // contains filtered or unexported fields }
func (*Node) BlockchainAddressGetBalance ¶
BlockchainGetBalance returns the balance of an address. Available(version < 1.3)
http://docs.electrum.org/en/latest/protocol.html#blockchain-address-get-balance
func (*Node) BlockchainAddressGetHistory ¶
func (n *Node) BlockchainAddressGetHistory(address string) ([]*Transaction, error)
BlockchainAddressGetHistory returns the history of an address. Available(version < 1.3)
http://docs.electrum.org/en/latest/protocol.html#blockchain-address-get-history
func (*Node) BlockchainAddressGetMempool ¶
TODO implement
Available(version < 1.3)
http://docs.electrum.org/en/latest/protocol.html#blockchain-address-get-mempool
func (*Node) BlockchainAddressListUnspent ¶
func (n *Node) BlockchainAddressListUnspent(address string) ([]*Transaction, error)
BlockchainAddressListUnspent lists the unspent transactions for the given address. Available(version < 1.3)
http://docs.electrum.org/en/latest/protocol.html#blockchain-address-listunspent
func (*Node) BlockchainAddressSubscribe ¶
BlockchainAddressSubscribe subscribes to transactions on an address and returns the hash of the transaction history. Available(version < 1.3)
http://docs.electrum.org/en/latest/protocol.html#blockchain-address-subscribe
func (*Node) BlockchainBlockGetChunk ¶
TODO implement BlockchainBlockGetChunk returns a chunk of block headers as a hexadecimal string. method: "blockchain.block.get_chunk"
document not updated
func (*Node) BlockchainBlockGetHeader ¶
TODO implement BlockchainBlockGetHeader returns the deserialized header at a given height. method "blockchain.block.get_header"
document not updated
func (*Node) BlockchainEstimateFee ¶
BlockchainEstimateFee returns the estimated transaction fee per kilobyte for a transaction to be confirmed within a certain number of blocks.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-estimatefee
func (*Node) BlockchainHeadersSubscribe ¶
func (n *Node) BlockchainHeadersSubscribe() (<-chan *BlockchainHeader, error)
BlockchainHeadersSubscribe subscribes to get raw headers of new blocks.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-headers-subscribe
func (*Node) BlockchainRelayfee ¶
TODO implement BlockchainRelayfee returns the minimum fee a low-priority tx must pay in order to be accepted to the daemon's memory pool. method: "blockchain.relayfee"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-relayfee
func (*Node) BlockchainScripthashGetBalance ¶
BlockchainScripthashGetBalance returns the confirmed and unconfirmed balance of a scripthash. method: "blockchain.scripthash.get_balance"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-scripthash-get-balance
func (*Node) BlockchainScripthashGetHistory ¶
func (n *Node) BlockchainScripthashGetHistory(scriptHash string) ([]*Transaction, error)
BlockchainScripthashGetHistory returns the confirmed and unconfirmed history of a scripthash. method: "blockchain.scripthash.get_history"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-scripthash-get-history
func (*Node) BlockchainScripthashGetMempool ¶
TODO implement BlockchainScripthashGetMempool returns the mempool transactions touching a scripthash. method: "blockchain.scripthash.get_mempool"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-scripthash-get-mempool
func (*Node) BlockchainScripthashListUnspent ¶
func (n *Node) BlockchainScripthashListUnspent(scriptHash string) ([]*Transaction, error)
TODO implement BlockchainScripthashListUnspent returns the list of UTXOs of a scripthash. method: "blockchain.scripthash.listunspent"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-scripthash-listunspent
func (*Node) BlockchainScripthashSubscribe ¶
BlockchainScripthashSubscribe subscribes to a script hash. method: "blockchain.scripthash.subscribe"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-scripthash-subscribe
func (*Node) BlockchainTransactionBroadcast ¶
TODO implement Broadcast a transaction to the network.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-transaction-broadcast
func (*Node) BlockchainTransactionGet ¶
func (n *Node) BlockchainTransactionGet(txid string, verbose bool) (*GetTransaction, error)
BlockchainTransactionGet returns a raw transaction.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-transaction-get
func (*Node) BlockchainTransactionGetMerkle ¶
TODO implement Return the merkle branch to a confirmed transaction given its hash and height.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#blockchain-transaction-get-merkle
func (*Node) ConnectSSL ¶
ConnectSLL creates a new SLL connection to the specified address.
func (*Node) ConnectTCP ¶
ConnectTCP creates a new TCP connection to the specified address.
func (*Node) Disconnect ¶
func (n *Node) Disconnect()
func (*Node) ServerAddPeer ¶
TODO implement ServerAddPeer add a peer (but only if the peer resolves to the source). method: "server.add_peer"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#server-add-peer
func (*Node) ServerBanner ¶
ServerBanner returns the server banner text.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#server-banner
func (*Node) ServerDonationAddress ¶
ServerDonationAddress returns the donation address of the server.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#server-donation-address
func (*Node) ServerFeatures ¶
TODO implement ServerFeatures returns the server features dictionary. method: "server.features"
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#server-features
func (*Node) ServerPeersSubscribe ¶
ServerPeersSubscribe requests peers from a server.
https://electrumx.readthedocs.io/en/latest/protocol-methods.html#server-peers-subscribe
func (*Node) ServerVersion ¶
TODO return concrete struct instead of unnamed string slice ServerVersion returns the server's version.
http://docs.electrum.org/en/latest/protocol.html#server-version
type ScriptPubKeyResult ¶
type ScriptPubKeyResult struct { Asm string `json:"asm"` Hex string `json:"hex,omitempty"` ReqSigs int32 `json:"reqSigs,omitempty"` Type string `json:"type"` Addresses []string `json:"addresses,omitempty"` }
ScriptPubKeyResult models the scriptPubKey data of a tx script. It is defined separately since it is used by multiple commands.
type ScriptSig ¶
ScriptSig models a signature script. It is defined separately since it only applies to non-coinbase. Therefore the field in the Vin structure needs to be a pointer.
type TCPTransport ¶
type TCPTransport struct {
// contains filtered or unexported fields
}
func NewSSLTransport ¶
func NewSSLTransport(addr string, config *tls.Config) (*TCPTransport, error)
func NewTCPTransport ¶
func NewTCPTransport(addr string) (*TCPTransport, error)
func (*TCPTransport) Errors ¶
func (t *TCPTransport) Errors() <-chan error
func (*TCPTransport) Responses ¶
func (t *TCPTransport) Responses() <-chan []byte
func (*TCPTransport) SendMessage ¶
func (t *TCPTransport) SendMessage(body []byte) error
type Transaction ¶
type Vin ¶
type Vin struct { Coinbase string `json:"coinbase"` Txid string `json:"txid"` Vout uint32 `json:"vout"` ScriptSig *ScriptSig `json:"scriptSig"` Sequence uint32 `json:"sequence"` }
Vin models parts of the tx data.
func (*Vin) IsCoinBase ¶
IsCoinBase returns a bool to show if a Vin is a Coinbase one or not.
func (*Vin) MarshalJSON ¶
MarshalJSON provides a custom Marshal method for Vin.
type Vout ¶
type Vout struct { Value float64 `json:"value"` N uint32 `json:"n"` ScriptPubKey ScriptPubKeyResult `json:"scriptPubKey"` }
Vout models parts of the tx data.