Versions in this module Expand all Collapse all v0 v0.1.0 Aug 2, 2022 Changes in this version + const ClientVersion + const ProtocolVersion + var DebugMode bool + var ErrCheckpointHeight = errors.New("checkpoint height must be greater than or equal to block height") + var ErrDeprecated = errors.New("RPC call has been deprecated") + var ErrNotImplemented = errors.New("RPC call is not implemented") + var ErrServerConnected = errors.New("server is already connected") + var ErrServerShutdown = errors.New("server has shutdown") + var ErrTimeout = errors.New("request timeout") + func AddressToElectrumScriptHash(addressStr string) (string, error) + type Client struct + Error chan error + func NewClientSSL(ctx context.Context, addr string, config *tls.Config) (*Client, error) + func NewClientTCP(ctx context.Context, addr string) (*Client, error) + func (s *Client) BroadcastTransaction(ctx context.Context, rawTx string) (string, error) + func (s *Client) GetBalance(ctx context.Context, scripthash string) (GetBalanceResult, error) + func (s *Client) GetBlockHeader(ctx context.Context, height uint32, checkpointHeight ...uint32) (*GetBlockHeaderResult, error) + func (s *Client) GetBlockHeaders(ctx context.Context, startHeight, count uint32, checkpointHeight ...uint32) (*GetBlockHeadersResult, error) + func (s *Client) GetFee(ctx context.Context, target uint32) (float32, error) + func (s *Client) GetFeeHistogram(ctx context.Context) (map[uint32]uint64, error) + func (s *Client) GetHashFromPosition(ctx context.Context, height, position uint32) (string, error) + func (s *Client) GetHistory(ctx context.Context, scripthash string) ([]*GetMempoolResult, error) + func (s *Client) GetMempool(ctx context.Context, scripthash string) ([]*GetMempoolResult, error) + func (s *Client) GetMerkleProof(ctx context.Context, txHash string, height uint32) (*GetMerkleProofResult, error) + func (s *Client) GetMerkleProofFromPosition(ctx context.Context, height, position uint32) (*GetMerkleProofFromPosResult, error) + func (s *Client) GetRawTransaction(ctx context.Context, txHash string) (string, error) + func (s *Client) GetRelayFee(ctx context.Context) (float32, error) + func (s *Client) GetTransaction(ctx context.Context, txHash string) (*GetTransactionResult, error) + func (s *Client) IsShutdown() bool + func (s *Client) ListUnspent(ctx context.Context, scripthash string) ([]*ListUnspentResult, error) + func (s *Client) Ping(ctx context.Context) error + func (s *Client) ServerAddPeer(ctx context.Context, features *ServerFeaturesResult) error + func (s *Client) ServerBanner(ctx context.Context) (string, error) + func (s *Client) ServerDonation(ctx context.Context) (string, error) + func (s *Client) ServerFeatures(ctx context.Context) (*ServerFeaturesResult, error) + func (s *Client) ServerPeers(ctx context.Context) (interface{}, error) + func (s *Client) ServerVersion(ctx context.Context) (serverVer, protocolVer string, err error) + func (s *Client) Shutdown() + func (s *Client) SubscribeHeaders(ctx context.Context) (<-chan *SubscribeHeadersResult, error) + func (s *Client) SubscribeMasternode(ctx context.Context, collateral string) (<-chan string, error) + func (s *Client) SubscribeScripthash() (*ScripthashSubscription, <-chan *SubscribeNotif) + type GetBalanceResp struct + Result GetBalanceResult + type GetBalanceResult struct + Confirmed float64 + Unconfirmed float64 + type GetBlockHeaderResp struct + Result *GetBlockHeaderResult + type GetBlockHeaderResult struct + Branch []string + Header string + Root string + type GetBlockHeadersResp struct + Result *GetBlockHeadersResult + type GetBlockHeadersResult struct + Branch []string + Count uint32 + Headers string + Max uint32 + Root string + type GetFeeResp struct + Result float32 + type GetMempoolResp struct + Result []*GetMempoolResult + type GetMempoolResult struct + Fee uint32 + Hash string + Height int32 + type GetMerkleProofFromPosResp struct + Result *GetMerkleProofFromPosResult + type GetMerkleProofFromPosResult struct + Hash string + Merkle []string + type GetMerkleProofResp struct + Result *GetMerkleProofResult + type GetMerkleProofResult struct + Height uint32 + Merkle []string + Position uint32 + type GetTransactionResp struct + Result *GetTransactionResult + type GetTransactionResult struct + Blockhash string + Blocktime uint64 + Confirmations int32 + Hash string + Hex string + Locktime uint32 + Merkle GetMerkleProofResult + Size uint32 + Time uint64 + Version uint32 + Vin []Vin + Vout []Vout + type ListUnspentResp struct + Result []*ListUnspentResult + type ListUnspentResult struct + Hash string + Height uint32 + Position uint32 + Value uint64 + type ScriptPubkey struct + Addresses []string + Asm string + Hex string + ReqSigs uint32 + Type string + type ScriptSig struct + Asm string + Hex string + type ScripthashSubscription struct + func (sub *ScripthashSubscription) Add(ctx context.Context, scripthash string, address ...string) error + func (sub *ScripthashSubscription) GetAddress(scripthash string) (string, error) + func (sub *ScripthashSubscription) GetChannel() <-chan *SubscribeNotif + func (sub *ScripthashSubscription) GetScripthash(address string) (string, error) + func (sub *ScripthashSubscription) Remove(scripthash string) error + func (sub *ScripthashSubscription) RemoveAddress(address string) error + func (sub *ScripthashSubscription) Resubscribe(ctx context.Context) error + type ServerFeaturesResp struct + Result *ServerFeaturesResult + type ServerFeaturesResult struct + GenesisHash string + HashFunction string + Hosts map[string]host + ProtocolMax string + ProtocolMin string + Pruning bool + ServerVersion string + type ServerVersionResp struct + Result [2]string + type SubscribeHeadersNotif struct + Params []*SubscribeHeadersResult + type SubscribeHeadersResp struct + Result *SubscribeHeadersResult + type SubscribeHeadersResult struct + Height int32 + Hex string + type SubscribeNotif struct + Params [2]string + type TCPTransport struct + func NewSSLTransport(ctx context.Context, addr string, config *tls.Config) (*TCPTransport, error) + func NewTCPTransport(ctx context.Context, addr string) (*TCPTransport, error) + func (t *TCPTransport) Close() error + func (t *TCPTransport) Errors() <-chan error + func (t *TCPTransport) Responses() <-chan []byte + func (t *TCPTransport) SendMessage(body []byte) error + type Transport interface + Close func() error + Errors func() <-chan error + Responses func() <-chan []byte + SendMessage func([]byte) error + type Vin struct + Coinbase string + ScriptSig *ScriptSig + Sequence uint32 + TxID string + Vout uint32 + type Vout struct + N uint32 + ScriptPubkey ScriptPubkey + Value float64