Skip to main content

ObjectId

ObjectId Objects​

class ObjectId(ObjectIdProtocol)

An ObjectId is a 32-byte identifier used to uniquely identify an object on the IOTA blockchain.

Relationship to Address​

Addresses and ObjectIds share the same 32-byte addressable space but are derived leveraging different domain-separator values to ensure, cryptographically, that there won't be any overlap, e.g. there can't be a valid Object whose ObjectId is equal to that of the Address of a user account.

BCS

The BCS serialized form of this type is specified in bcs-schema.abnf.

derive_id​

@classmethod
def derive_id(cls, digest: TransactionDigest, count: int) -> ObjectId

Create an ObjectId from a transaction digest and the number of objects that have been created during a transactions.

from_bcs​

@classmethod
def from_bcs(cls, bcs: bytes) -> ObjectId

Create this type from BCS encoded bytes.

from_hex​

@classmethod
def from_hex(cls, hex: str) -> ObjectId

Parses an ObjectId from a full-length hex string (64 hex characters), with or without a 0x prefix. Will return an error if the string is not exactly 64 hex characters long (excluding the 0x prefix).

from_json​

@classmethod
def from_json(cls, json: str) -> ObjectId

Create this type from a JSON encoded string.

from_prefixed_hex​

@classmethod
def from_prefixed_hex(cls, hex: str) -> ObjectId

Parses an ObjectId from a full-length hex string (64 hex characters), with a mandatory 0x prefix. Will return an error if the string is not exactly 64 hex characters long (excluding the 0x prefix).

from_prefixed_short_hex​

@classmethod
def from_prefixed_short_hex(cls, hex: str) -> ObjectId

Parses an ObjectId from a hex string with a mandatory 0x prefix. The string can be of variable length; if it's shorter than 64 hex characters, it will be left-padded with 0s.

from_raw_hex​

@classmethod
def from_raw_hex(cls, hex: str) -> ObjectId

Parses an ObjectId from a full-length hex string (64 hex characters), without a 0x prefix. Will return an error if the string has a 0x prefix or is not exactly 64 hex characters long.

from_raw_short_hex​

@classmethod
def from_raw_short_hex(cls, hex: str) -> ObjectId

Parses an ObjectId from a hex string without a 0x prefix. The string can be of variable length; if it's shorter than 64 hex characters, it will be left-padded with 0s. Will return an error if the string has a 0x prefix.

from_short_hex​

@classmethod
def from_short_hex(cls, hex: str) -> ObjectId

Parses an ObjectId from a hex string, with or without a 0x prefix. The string can be of variable length; if it's shorter than 64 hex characters, it will be left-padded with 0s.

derive_dynamic_child_id​

def derive_dynamic_child_id(key_type_tag: TypeTag,
key_bytes: bytes) -> ObjectId

Derive an ObjectId for a Dynamic Child Object.

hash(parent || len(key) || key || key_type_tag)

derive_object_id​

def derive_object_id(key_type_tag: TypeTag, key_bytes: bytes) -> ObjectId

Derive the ObjectId of a derived object (0x2::derived_object).

hash(parent || len(key) || key || DerivedObjectKey(key_type_tag))

next_lexicographical​

def next_lexicographical() -> ObjectId

Returns the next digest in byte-increasing order.

next_lexicographical_opt​

def next_lexicographical_opt() -> typing.Optional[ObjectId]

Returns the next digest in byte-increasing order, or None if the result would overflow.

to_bcs​

def to_bcs() -> bytes

Convert this type to BCS encoded bytes.

to_canonical_string​

def to_canonical_string(with_prefix: bool) -> str

Returns the string representation of this object ID using the canonical display, with or without a 0x prefix.

to_display_string​

def to_display_string() -> str

Render this type as human-readable text.

Some types also print this through the binding's native string conversion; this method is the spelling every object type has.

The layout is meant for reading and can change between releases. Use the JSON or BCS conversions for output that gets parsed.

to_hex​

def to_hex() -> str

Returns the string representation of this object id in hex format with 0x prefix.

to_json​

def to_json() -> str

Convert this type to a JSON encoded string.

to_raw_hex​

def to_raw_hex() -> str

Returns the string representation of this object id in hex format without 0x prefix.

to_raw_short_hex​

def to_raw_short_hex() -> str

Returns the shortest possible string representation of the object id (i.e. with leading zeroes trimmed), without 0x prefix.

to_short_hex​

def to_short_hex() -> str

Returns the shortest possible string representation of the object ID (i.e. with leading zeroes trimmed).