Expand description
Core type definitions for the IOTA blockchain.
IOTA is a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language. This crate provides type definitions for working with the data that makes up the IOTA blockchain.
§Feature flags
This library uses a set of feature flags to reduce the number of dependencies and amount of compiled code. By default, no features are enabled which allows one to enable a subset specifically for their use case. Below is a list of the available feature flags.
serde: Enables support for serializing and deserializing types to/from BCS utilizing serde library. Note: JSON serialization is NOT guaranteed to match the IOTA monorepo’s JSON-RPC format.rand: Enables support for generating random instances of a number of types via the rand library.hash: Enables support for hashing, which is required for deriving addresses and calculating digests for various types.proptest: Enables support for the proptest library by providing implementations of proptest::arbitrary::Arbitrary for many types.
§BCS
BCS is the serialization format used to represent the state of the blockchain and is used extensively throughout the IOTA ecosystem. In particular the BCS format is leveraged because it “guarantees canonical serialization, meaning that for any given data type, there is a one-to-one correspondence between in-memory values and valid byte representations.” One benefit of this property of having a canonical serialized representation is to allow different entities in the ecosystem to all agree on how a particular type should be interpreted and more importantly define a deterministic representation for hashing and signing.
This library strives to guarantee that the types defined are fully
BCS-compatible with the data that the network produces. The one caveat to
this would be that as the IOTA protocol evolves, new type variants are added
and older versions of this library may not support those newly
added variants. The expectation is that the most recent release of this
library will support new variants and types as they are released to IOTA’s
testnet network.
See the documentation for the various types defined by this crate for a specification of their BCS serialized representation which will be defined using ABNF notation as described by RFC-5234. In addition to the format itself, some types have an extra layer of verification and may impose additional restrictions on valid byte representations above and beyond those already provided by BCS. In these instances the documentation for those types will clearly specify these additional restrictions.
Here are some common rules:
; --- BCS Value ---
bcs-value = bcs-struct / bcs-enum / bcs-length-prefixed / bcs-fixed-length
bcs-length-prefixed = bytes / string / vector / option
bcs-fixed-length = u8 / u16 / u32 / u64 / u128 /
i8 / i16 / i32 / i64 / i128 /
bool
bcs-struct = *bcs-value ; Sequence of serialized fields
bcs-enum = uleb128 bcs-value ; Variant index (ULEB128) + associated value
; --- Named primitives ---
uleb128 = *(%x80-FF) %x00-7F ; Variable-length unsigned integer
size = uleb128 ; BCS sequence / string length
opt = %d00 ; None — no value follows
/ %d01 ; Some — value follows
; --- Length-prefixed types ---
bytes = size *OCTET ; Raw bytes
string = size *OCTET ; UTF-8 string
vector = size *bcs-value ; Length-prefixed list of values
option = %d00 / (%d01 bcs-value) ; Optional value
; --- Fixed-length types ---
u8 = 1OCTET ; 1-byte unsigned integer
u16 = 2OCTET ; 2-byte unsigned integer, little-endian
u32 = 4OCTET ; 4-byte unsigned integer, little-endian
u64 = 8OCTET ; 8-byte unsigned integer, little-endian
u128 = 16OCTET ; 16-byte unsigned integer, little-endian
i8 = 1OCTET ; 1-byte signed integer
i16 = 2OCTET ; 2-byte signed integer, little-endian
i32 = 4OCTET ; 4-byte signed integer, little-endian
i64 = 8OCTET ; 8-byte signed integer, little-endian
i128 = 16OCTET ; 16-byte signed integer, little-endian
bool = %d00 ; false
/ %d01 ; true
array = *(bcs-value) ; Fixed-length array (no length prefix)Re-exports§
pub use address::Address;pub use address::AddressParseError;pub use checkpoint::CheckpointCommitment;pub use checkpoint::CheckpointContents;pub use checkpoint::CheckpointContentsV1;pub use checkpoint::CheckpointData;pub use checkpoint::CheckpointSequenceNumber;pub use checkpoint::CheckpointSummary;pub use checkpoint::CheckpointTimestamp;pub use checkpoint::CheckpointTransaction;pub use checkpoint::CheckpointTransactionInfo;pub use checkpoint::EndOfEpochData;pub use checkpoint::EpochId;pub use checkpoint::ProtocolVersion;pub use checkpoint::SignedCheckpointSummary;pub use checkpoint::StakeUnit;pub use crypto::Bls12381PublicKey;pub use crypto::Bls12381Signature;pub use crypto::Ed25519PublicKey;pub use crypto::Ed25519Signature;pub use crypto::HashingIntentScope;pub use crypto::INTENT_PREFIX_LENGTH;pub use crypto::Intent;pub use crypto::IntentAppId;pub use crypto::IntentError;pub use crypto::IntentMessage;pub use crypto::IntentScope;pub use crypto::IntentVersion;pub use crypto::InvalidSignatureScheme;pub use crypto::MoveAuthenticator;pub use crypto::MoveAuthenticatorV1;pub use crypto::MultisigAggregatedSignature;pub use crypto::MultisigCommittee;pub use crypto::MultisigMember;pub use crypto::MultisigMemberSignature;pub use crypto::PasskeyAuthenticator;pub use crypto::PasskeyPublicKey;pub use crypto::PersonalMessage;pub use crypto::PublicKey;pub use crypto::PublicKeyError;pub use crypto::PublicKeyExt;pub use crypto::Secp256k1PublicKey;pub use crypto::Secp256k1Signature;pub use crypto::Secp256r1PublicKey;pub use crypto::Secp256r1Signature;pub use crypto::SignatureScheme;pub use crypto::SimpleSignature;pub use crypto::UserSignature;pub use digest::CertificateDigest;pub use digest::CheckpointContentsDigest;pub use digest::CheckpointDigest;pub use digest::ConsensusCommitDigest;pub use digest::Digest;pub use digest::DigestParseError;pub use digest::EffectsAuxDataDigest;pub use digest::MisbehaviorReportDigest;pub use digest::MoveAuthenticatorDigest;pub use digest::ObjectDigest;pub use digest::SenderSignedDataDigest;pub use digest::SigningDigest;pub use digest::TransactionDigest;pub use digest::TransactionEffectsDigest;pub use digest::TransactionEventsDigest;pub use effects::ChangedObject;pub use effects::IdOperation;pub use effects::ObjectChange;pub use effects::ObjectIn;pub use effects::ObjectOut;pub use effects::ObjectRemoveKind;pub use effects::TransactionEffects;pub use effects::TransactionEffectsV1;pub use effects::WriteKind;pub use events::Event;pub use events::TransactionEvents;pub use execution_status::CommandArgumentError;pub use execution_status::ExecutionError;pub use execution_status::ExecutionStatus;pub use execution_status::MoveLocation;pub use execution_status::PackageUpgradeError;pub use execution_status::TypeArgumentError;pub use framework::Coin;pub use gas::GasCostSummary;pub use move_core::Identifier;pub use move_core::MAX_IDENTIFIER_LENGTH;pub use move_core::MAX_TYPE_TAG_NESTING;pub use move_core::StructTag;pub use move_core::TypeParseError;pub use move_core::TypeTag;pub use move_package::MovePackage;pub use move_package::MovePackageData;pub use move_package::TypeOrigin;pub use move_package::UpgradeInfo;pub use move_package::UpgradePolicy;pub use object::GenesisObject;pub use object::MoveObjectType;pub use object::MoveStruct;pub use object::MoveStructContentsError;pub use object::Object;pub use object::ObjectData;pub use object::ObjectReference;pub use object::ObjectType;pub use object::ObjectVersion;pub use object::OwnedObjectReference;pub use object::Owner;pub use object_id::ObjectId;pub use transaction::Argument;pub use transaction::CanceledTransaction;pub use transaction::ChangeEpoch;pub use transaction::ChangeEpochV2;pub use transaction::ChangeEpochV3;pub use transaction::ChangeEpochV4;pub use transaction::Command;pub use transaction::ConsensusCommitPrologueV1;pub use transaction::ConsensusDeterminedVersionAssignments;pub use transaction::DenyRuleSet;pub use transaction::EndOfEpochTransactionKind;pub use transaction::GasPayment;pub use transaction::GenesisTransaction;pub use transaction::Input;pub use transaction::MakeMoveVector;pub use transaction::MergeCoins;pub use transaction::MoveCall;pub use transaction::ProgrammableTransaction;pub use transaction::Publish;pub use transaction::RandomnessRound;pub use transaction::RandomnessStateUpdate;pub use transaction::SenderSignedTransaction;pub use transaction::SignedTransaction;pub use transaction::SplitCoins;pub use transaction::SystemPackage;pub use transaction::Transaction;pub use transaction::TransactionDenyRulesUpdate;pub use transaction::TransactionExpiration;pub use transaction::TransactionKind;pub use transaction::TransactionV1;pub use transaction::TransferObjects;pub use transaction::Upgrade;pub use transaction::VersionAssignment;pub use validator::ValidatorAggregatedSignature;pub use validator::ValidatorCommittee;pub use validator::ValidatorCommitteeMember;pub use validator::ValidatorSignature;pub use version::Version;
Modules§
- address
- checkpoint
- crypto
- digest
- effects
- events
- execution_
status - framework
- Rust definitions of move/iota framework types.
- gas
- hash
hash - iota_
names - move_
core - move_
package - object
- object_
id - transaction
- u256
- utils
- validator
- version
Macros§
Functions§
- next_
lexicographical_ array - Returns the next array in byte-increasing order.
- next_
lexicographical_ array_ opt - Returns the next array in byte-increasing order, or
Noneif the result would overflow.