pybitmessage.protocol module¶
Low-level protocol-related functions.
-
NODE_SSL
= 2[source]¶ This node supports SSL/TLS in the current connect (python < 2.7.9 only supports an SSL client, so in that case it would only have this on when the connection is a client).
-
network_group
(host)[source]¶ Canonical identifier of network group simplified, borrowed from GetGroup() in src/netaddresses.cpp in bitcoin core
-
checkIPAddress
(host, private=False)[source]¶ Returns hostStandardFormat if it is a valid IP address, otherwise returns False
-
checkIPv4Address
(host, hostStandardFormat, private=False)[source]¶ Returns hostStandardFormat if it is an IPv4 address, otherwise returns False
-
checkIPv6Address
(host, hostStandardFormat, private=False)[source]¶ Returns hostStandardFormat if it is an IPv6 address, otherwise returns False
-
haveSSL
(server=False)[source]¶ Predicate to check if ECDSA server support is required and available
python < 2.7.9’s ssl library does not support ECDSA server due to missing initialisation of available curves, but client works ok
-
isProofOfWorkSufficient
(data, nonceTrialsPerByte=0, payloadLengthExtraBytes=0, recvTime=0)[source]¶ Validate an object’s Proof of Work using method described here
Parameters: Returns: True if PoW valid and sufficient, False in all other cases
-
assembleVersionMessage
(remoteHost, remotePort, participatingStreams, server=False, nodeid=None)[source]¶ Construct the payload of a version message, return the resulting bytes of running
CreatePacket
on it
-
assembleErrorMessage
(fatal=0, banTime=0, inventoryVector='', errorText='')[source]¶ Construct the payload of an error message, return the resulting bytes of running
CreatePacket
on it
-
decryptAndCheckPubkeyPayload
(data, address)[source]¶ Version 4 pubkeys are encrypted. This function is run when we already have the address to which we want to try to send a message. The ‘data’ may come either off of the wire or we might have had it already in our inventory when we tried to send a msg to this particular address.