pybitmessage.addresses module

Operations with addresses

encodeBase58(num)[source]

Encode a number in Base X

Parameters:
  • num – The number to encode
  • alphabet – The alphabet to use for encoding
decodeBase58(string)[source]

Decode a Base X encoded string into the number

Parameters:
  • string – The encoded string
  • alphabet – The alphabet to use for encoding
exception varintEncodeError[source]

Bases: exceptions.Exception

Exception class for encoding varint

exception varintDecodeError[source]

Bases: exceptions.Exception

Exception class for decoding varint data

encodeVarint(integer)[source]

Convert integer into varint bytes

decodeVarint(data)[source]

Decodes an encoded varint to an integer and returns it. Per protocol v3, the encoded value must be encoded with the minimum amount of data possible or else it is malformed. Returns a tuple: (theEncodedValue, theSizeOfTheVarintInBytes)

encodeAddress(version, stream, ripe)[source]

Convert ripe to address

decodeAddress(address)[source]

returns (status, address version number, stream number, data (almost certainly a ripe hash))

addBMIfNotPresent(address)[source]

Prepend BM- to an address if it doesn’t already have it