- Rust client: code snippet assuming you depend on
sui-types(andconsensus-corefor/v1/accepted). - Raw BCS schema: structural description for clients that cannot import Sui crates.
SenderSignedData, TransactionEffects, TransactionEvents, etc.) which are themselves complex nested BCS types. The canonical authoritative definitions live in the Sui source tree under crates/sui-types/src/; many language ecosystems also ship Sui-SDK packages with type-equivalent decoders.
BCS encoding conventions
- Fields are emitted in struct-declaration order with no field names.
- Fixed-size
[u8; N]arrays serialize asNlength-prefixed bytes β the length prefix is a ULEB128 byte (0x20for 32-byte digests). u8/u16/u32/u64are little-endian.Vec<T>= ULEB128 length, thenlengthconsecutiveTvalues.Option<T>=0x00(None) or0x01 <T>(Some).- Enums = ULEB128 variant index, then variant payload.
String=Vec<u8>(UTF-8 bytes with a length prefix).
/v1/incoming β BCS Transaction
Each WS frame is one BCS-encodedsui_types::transaction::Transaction, byte-identical to the bytes the submitting client sent to the validatorβs gRPC endpoint.
Transaction is Envelope<SenderSignedData, EmptySignInfo>. EmptySignInfo is a zero-sized unit struct, so the on-wire bytes equal a bare SenderSignedData.
Rust client:
TransactionData, GenericSignature, etc. are defined in sui-types/src/transaction.rs and sui-types/src/crypto.rs. Most Sui SDKs already include decoders.
/v1/accepted β BCS SignedBlock
Each WS frame is one BCS-encodedconsensus_core::block::SignedBlock β exactly the bytes the validator received on the wire from a peer. One block contains many transactions; each transaction inside is itself a BCS-encoded ConsensusTransaction.
Rust client (using consensus-coreβs helper):
ConsensusTransactionKind are stable; the exact index of UserTransaction and UserTransactionV2 is defined in sui-types/src/messages_consensus.rs. Non-user variants can be skipped.
For each UserTransaction* you encounter, the inner SenderSignedData is identical in shape to the /v1/incoming payload.
CommitVote, BlockTransactionVotes, MisbehaviorReport, TransactionClaim are defined in consensus-core/src/{block,commit}.rs and sui-types/src/messages_consensus.rs.
/v1/pending β BCS PendingTxStreamMessage
/v1/executed β BCS TxStreamMessage
TransactionEffects is a versioned enum (V1 / V2); BCS encodes the variant index as a ULEB128 byte followed by the variant payload. TransactionEvents is Vec<Event>. Both are defined in sui-types/src/effects.rs.
System transactions are filtered server-side and never appear on this stream.