Expand description
Core type definitions for the Sui blockchain.
Sui 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 Sui 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.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 Sui 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 Sui 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 Sui’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 /
boolean
bcs-struct = *bcs-value ; Sequence of serialized fields
bcs-enum = uleb128-index bcs-value ; Enum index and associated value
; --- Length-prefixed types ---
bytes = uleb128 *OCTET ; Raw bytes of the specified length
string = uleb128 *OCTET ; valid utf8 string of the specified length
vector = uleb128 *bcs-value ; Length-prefixed list of values
option = %x00 / (%x01 bcs-value) ; optional value
; --- Fixed-length types ---
u8 = OCTET ; 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 = OCTET ; 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
boolean = %x00 / %x01 ; Boolean: 0 = false, 1 = true
array = *(bcs-value) ; Fixed-length array
; --- ULEB128 definition ---
uleb128 = 1*5uleb128-byte ; Variable-length ULEB128 encoding
uleb128-byte = %x00-7F / %x80-FF ; ULEB128 continuation rules
uleb128-index = uleb128 ; ULEB128-encoded variant index
Modules§
- Rust definitions of move/sui framework types.
- hash
hash
Structs§
- A new Jwk
- Unique identifier for an Account on the Sui blockchain.
- Expire old JWKs
- Update the set of valid JWKs
- A bls12381 min-sig public key.
- A bls12381 min-sig signature.
- A point on the BN254 elliptic curve.
- A transaction that was cancelled
- System transaction used to change the epoch
- Input/output state of an object that was changed during execution
- The committed to contents of a checkpoint.
- A header for a Checkpoint on the Sui blockchain.
- Transaction information committed to in a checkpoint
- A G1 point
- A G2 point
- V1 of the consensus commit prologue system transaction
- V2 of the consensus commit prologue system transaction
- V3 of the consensus commit prologue system transaction
- A 32-byte Blake2b256 hash output.
- An ed25519 public key.
- An ed25519 signature.
- Data, which when included in a
CheckpointSummary
, signals the end of anEpoch
. - An event
- Summary of gas charges.
- Payment information for executing a transaction
- An object part of the initial chain state
- The genesis transaction
- A move identifier
- A Signing Intent
- A JSON Web Key
- Key to uniquely identify a JWK
- Command to build a move vector out of a set of individual elements
- Command to merge multiple coins of the same type into a single coin
- Indicates that an Object was modified at a specific version
- Command to call a move function
- Location in move bytecode where an error occurred
- A move package
- A move struct
- Aggregated signature from members of a multisig committee.
- A multisig committee
- A member in a multisig committee
- An object on the sui blockchain
- An
ObjectId
is a 32-byte identifier used to uniquely identify an object on the Sui blockchain. - Reference to an object
- An object reference with owner information
- A passkey authenticator.
- Public key of a
PasskeyAuthenticator
. - A user transaction
- Command to publish a new move package
- Randomness update
- A secp256k1 public key.
- A secp256k1 signature.
- A secp256r1 public key.
- A secp256r1 signature.
- Command to split a single coin object into multiple coins
- Type information for a move struct
- System package
- A transaction
- Version 1 of TransactionEffects
- Version 2 of TransactionEffects
- Events emitted during the successful execution of a transaction
- Command to transfer ownership of a set of objects to an address
- Identifies a struct and the module it was defined in
- A shared object that wasn’t changed during execution
- Command to upgrade an already published package
- Upgraded package info for the linkage table
- An aggregated signature from multiple Validators.
- The Validator Set for a particular epoch.
- A member of a Validator Committee
- A signature from a Validator
- Object version assignment from consensus
- A zklogin authenticator
- A zklogin groth16 proof and the required inputs to perform proof verification.
- A zklogin groth16 proof
- Public Key equivalent for Zklogin authenticators
- A claim of the iss in a zklogin proof
Enums§
- An argument to a programmable transaction command
- A commitment made by a checkpoint.
- A single command in a programmable transaction.
- An error with an argument to a command
- Version assignments performed by consensus
- Operation run at the end of an epoch
- An error that can occur during the execution of a transaction
- The status of an executed Transaction
- Defines what happened to an ObjectId during execution
- An input to a user transaction
- Byte signifying the application id of an
Intent
- Byte signifying the scope of an
Intent
- Byte signifying the version of an
Intent
- Enum of valid public keys for multisig committee members
- A signature from a member of a multisig committee.
- Object data, either a package or struct
- State of an object prior to execution
- State of an object after execution
- Type of a Sui object
- Enum of different types of ownership for an object.
- An error with a upgrading a package
- Flag use to disambiguate the signature schemes supported by Sui.
- A basic signature
- The output or effects of executing a transaction
- A TTL for a transaction
- Transaction type
- An error with a type argument
- Type of a move value
- Type of unchanged shared object
- A signature from a user