Documentation ¶
Overview ¶
Package electrum is a electrum bitcoin client.
Index ¶
- Constants
- Variables
- type Balance
- type BlockchainHeader
- 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) BlockchainAddressGetProof() error
- func (n *Node) BlockchainAddressListUnspent(address string) ([]*Transaction, error)
- func (n *Node) BlockchainAddressSubscribe(address string) (<-chan string, error)
- func (n *Node) BlockchainBlockGetChunk() error
- func (n *Node) BlockchainBlockGetHeader() error
- func (n *Node) BlockchainEstimateFee(block int) (float64, error)
- func (n *Node) BlockchainHeadersSubscribe() (<-chan *BlockchainHeader, error)
- func (n *Node) BlockchainNumBlocksSubscribe() (int, error)
- func (n *Node) BlockchainTransactionBroadcast(tx []byte) (interface{}, error)
- func (n *Node) BlockchainTransactionGet(txid string) (string, error)
- func (n *Node) BlockchainTransactionGetMerkle() error
- func (n *Node) BlockchainUtxoGetAddress() error
- func (n *Node) ConnectSSL(addr string, config *tls.Config) error
- func (n *Node) ConnectTCP(addr string) error
- func (n *Node) ServerBanner() (string, error)
- func (n *Node) ServerDonationAddress() (string, error)
- func (n *Node) ServerPeersSubscribe() ([][]interface{}, error)
- func (n *Node) ServerVersion() (string, error)
- type TCPTransport
- type Transaction
- type Transport
Constants ¶
const ( ClientVersion = "0.0.1" ProtocolVersion = "1.0" )
Variables ¶
var ( ErrNotImplemented = errors.New("not implemented") ErrNodeConnected = errors.New("node already connected") )
Functions ¶
This section is empty.
Types ¶
type BlockchainHeader ¶
type BlockchainHeader struct { Nonce uint64 `json:"nonce"` PrevBlockHash string `json:"prev_block_hash"` Timestamp uint64 `json:"timestamp"` MerkleRoot string `json:"merkle_root"` BlockHeight uint64 `json:"block_height"` UtxoRoot string `json:"utxo_root"` Version int `json:"version"` Bits uint64 `json:"bits"` }
type Node ¶
type Node struct { Address string // contains filtered or unexported fields }
func (*Node) BlockchainAddressGetBalance ¶
BlockchainAddressGetBalance returns the balance of an address. TODO (d4l3k) investigate `error from server: "'Node' object has no attribute '__getitem__'"` 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. http://docs.electrum.org/en/latest/protocol.html#blockchain-address-get-history
func (*Node) BlockchainAddressGetMempool ¶
TODO(d4l3k) implement http://docs.electrum.org/en/latest/protocol.html#blockchain-address-get-mempool
func (*Node) BlockchainAddressGetProof ¶
TODO(d4l3k) implement http://docs.electrum.org/en/latest/protocol.html#blockchain-address-get-proof
func (*Node) BlockchainAddressListUnspent ¶
func (n *Node) BlockchainAddressListUnspent(address string) ([]*Transaction, error)
BlockchainAddressListUnspent lists the unspent transactions for the given address. 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. http://docs.electrum.org/en/latest/protocol.html#blockchain-address-subscribe
func (*Node) BlockchainBlockGetChunk ¶
TODO(d4l3k) implement http://docs.electrum.org/en/latest/protocol.html#blockchain-block-get-chunk
func (*Node) BlockchainBlockGetHeader ¶
TODO(d4l3k) implement http://docs.electrum.org/en/latest/protocol.html#blockchain-block-get-header
func (*Node) BlockchainEstimateFee ¶
http://docs.electrum.org/en/latest/protocol.html#blockchain-estimatefee BlockchainEstimateFee estimates the transaction fee per kilobyte that needs to be paid for a transaction to be included within a certain number of blocks.
func (*Node) BlockchainHeadersSubscribe ¶
func (n *Node) BlockchainHeadersSubscribe() (<-chan *BlockchainHeader, error)
BlockchainHeadersSubscribe request client notifications about new blocks in form of parsed blockheaders and returns the current block header. http://docs.electrum.org/en/latest/protocol.html#blockchain-headers-subscribe
func (*Node) BlockchainNumBlocksSubscribe ¶
BlockchainNumBlocksSubscribe returns the current number of blocks. http://docs.electrum.org/en/latest/protocol.html#blockchain-numblocks-subscribe
func (*Node) BlockchainTransactionBroadcast ¶
BlockchainTransactionBroadcast sends a raw transaction. TODO(d4l3k) implement http://docs.electrum.org/en/latest/protocol.html#blockchain-transaction-broadcast
func (*Node) BlockchainTransactionGet ¶
BlockchainTransactionGet returns the raw transaction (hex-encoded) for the given txid. If transaction doesn't exist, an error is returned. http://docs.electrum.org/en/latest/protocol.html#blockchain-transaction-get
func (*Node) BlockchainTransactionGetMerkle ¶
TODO(d4l3k) implement http://docs.electrum.org/en/latest/protocol.html#blockchain-transaction-get-merkle
func (*Node) BlockchainUtxoGetAddress ¶
TODO(d4l3k) implement http://docs.electrum.org/en/latest/protocol.html#blockchain-utxo-get-address
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) ServerBanner ¶
ServerBanner returns the server's banner. http://docs.electrum.org/en/latest/protocol.html#server-banner
func (*Node) ServerDonationAddress ¶
ServerDonationAddress returns the donation address of the server. http://docs.electrum.org/en/latest/protocol.html#server-donation-address
func (*Node) ServerPeersSubscribe ¶
ServerPeersSubscribe requests peers from a server. http://docs.electrum.org/en/latest/protocol.html#server-peers-subscribe
func (*Node) ServerVersion ¶
ServerVersion returns the server's version. http://docs.electrum.org/en/latest/protocol.html#server-version
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