bitcoincash.electrum¶
Everything dealing with an Electrum RPC server is found in the core subpackage.
electrum
¶
-
class
bitcoincash.electrum.
Electrum
(loop=None)[source]¶ Bases:
bitcoincash.electrum.client.StratumClient
Setup state needed to handle req/resp from a single Stratum server. Requires a transport (TransportABC) object to do the communication.
client
¶
-
class
bitcoincash.electrum.client.
StratumClient
(loop=None)[source]¶ Bases:
object
Setup state needed to handle req/resp from a single Stratum server. Requires a transport (TransportABC) object to do the communication.
-
RPC
(method, *params)[source]¶ Perform a remote command.
Expects a method name, which look like:
blockchain.address.get_balanceReturns a future which will you should await for the result from the server. Failures are returned as exceptions.
-
connect
(server_info=None, proto_code=None, *, use_tor=False, disable_cert_verify=False, proxy=None, short_term=False)[source]¶ Start connection process. Destination must be specified in a ServerInfo() record (first arg).
-
subscribe
(method, *params)[source]¶ Perform a remote command which will stream events/data to us.
- Expects a method name, which look like:
- server.peers.subscribe
Returns a tuple: (Future, asyncio.Queue). The future will have the result of the initial call, and the queue will receive additional responses as they happen.
-
constants
¶
-
bitcoincash.electrum.constants.
DEFAULT_SERVER
= 'bitcoincash.network'¶ If server info is not provided, default to this server.
-
bitcoincash.electrum.constants.
PROTOCOL_CODES
= {'g': 'Websocket', 'h': 'HTTP (plaintext)', 's': 'SSL', 't': 'TCP (plaintext)'}¶ Which protocol is used. Usually paired with port number.
protocol
¶
-
class
bitcoincash.electrum.protocol.
StratumProtocol
[source]¶ Bases:
asyncio.protocols.Protocol
-
buf
= b''¶
-
client
= None¶
-
closed
= False¶
-
connection_lost
(exc)[source]¶ Called when the connection is lost or closed.
The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed).
-
connection_made
(transport)[source]¶ Called when a connection is made.
The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called.
-
transport
= None¶
-
svr_info
¶
-
class
bitcoincash.electrum.svr_info.
KnownServers
[source]¶ Bases:
dict
Store a list of known servers and their port numbers, etc.
- can add single entries
- can read from a CSV for seeding/bootstrap
- can read from IRC channel to find current hosts
We are a dictionary, with key being the hostname (in lowercase) of the server.
-
class
bitcoincash.electrum.svr_info.
ServerInfo
(nickname_or_dict, hostname=None, ports=None, version=None, pruning_limit=None, ip_addr=None)[source]¶ Bases:
dict
Information to be stored on a server. Originally based on IRC data published to a channel.
-
FIELDS
= ['nickname', 'hostname', 'ports', 'version', 'pruning_limit']¶
-
get_port
(for_protocol)[source]¶ Return (hostname, port number, ssl) pair for the protocol. Assuming only one port per host.
-
hostname
¶
-
is_onion
¶
-
protocols
¶
-
pruning_limit
¶
-