ByteData

All other transaction components inherit from this class.

class riemann.tx.ByteData

Wrapper class for byte-like data Iterable and subscriptable (by iterating and subscribing to wrapped data) Can be made immutable self._bytes is a bytearray object when mutable self._bytes is a byte object when immutable Should be mostly transparent to the user Can be treated like bytes or a bytearray in most cases

find(substring: Union[bytes, bytearray, ByteData]) → int

byte-like -> int Finds the index of substring

classmethod from_bytes(byte_string: bytes) → riemann.tx.shared.ByteData
classmethod from_hex(hex_string: str)
hex() → str

ByteData -> hex_string

to_bytes() → bytes

ByteData -> bytes

static validate_bytes(data: Any, length: Optional[int] = 4)

Raises ValueError if data is not bytes. Raises ValueError if len(data) is not length. Length may be None for unknown lengths (e.g. scripts). length=None will allow 0 length data.