ethereum_types.bytes

Sequences of 256-bit values.

B

7
B = TypeVar("B", bound="FixedBytes")

FixedBytes

Superclass for fixed sized byte arrays. Not intended to be used directly, but should be subclassed.

class FixedBytes:

LENGTH

16
    LENGTH: ClassVar[int]

__slots__

21
    __slots__ = ()

__new__

Create a new instance, ensuring the result has the correct length.

def __new__(cls: Type[B], ​​*args: Any, ​​**kwargs: Any) -> B:
24
        """
25
        Create a new instance, ensuring the result has the correct length.
26
        """
27
        result = super(FixedBytes, cls).__new__(cls, *args, **kwargs)
28
        if len(result) != cls.LENGTH:
29
            raise ValueError(
30
                f"expected {cls.LENGTH} bytes but got {len(result)}"
31
            )
32
        return result

Bytes0

Byte array of exactly zero elements.

class Bytes0:

LENGTH

40
    LENGTH = 0

Bytes1

Byte array of exactly one elements.

class Bytes1:

LENGTH

51
    LENGTH = 1

Bytes4

Byte array of exactly four elements.

class Bytes4:

LENGTH

62
    LENGTH = 4

Bytes8

Byte array of exactly eight elements.

class Bytes8:

LENGTH

73
    LENGTH = 8

Bytes20

Byte array of exactly 20 elements.

class Bytes20:

LENGTH

84
    LENGTH = 20

Bytes32

Byte array of exactly 32 elements.

class Bytes32:

LENGTH

95
    LENGTH = 32

Bytes48

Byte array of exactly 48 elements.

class Bytes48:

LENGTH

106
    LENGTH = 48

Bytes64

Byte array of exactly 64 elements.

class Bytes64:

LENGTH

114
    LENGTH = 64

Bytes96

Byte array of exactly 96 elements.

class Bytes96:

LENGTH

125
    LENGTH = 96

Bytes256

Byte array of exactly 256 elements.

class Bytes256:

LENGTH

136
    LENGTH = 256

Bytes

Sequence of bytes (octets) of arbitrary length.

142
Bytes = bytes