Rust SDK
The Rust SDK exposes the same pre-flight policy as the TypeScript SDK, but in plain Rust data structures.
Install
Section titled “Install”cargo add ckb-transaction-firewall-sdkWhat it provides
Section titled “What it provides”- A
check_transactionhelper FirewallConfigfor the registry script identity- Structured error codes for missing, invalid, or ambiguous registry data
Basic usage
Section titled “Basic usage”use ckb_transaction_firewall_sdk::{ check_transaction, CellDepLike, FirewallConfig, HashType, ScriptLike, TxOutputLike, UnsignedTxLike,};
let registry_script = ScriptLike { code_hash: [0xbb; 32], hash_type: HashType::Type, args: vec![0x01, 0x02, 0x03],};
let tx = UnsignedTxLike { cell_deps: vec![CellDepLike { type_script: Some(registry_script.clone()), data: hex::decode("424c4b4c0100000000").unwrap(), }], outputs: vec![TxOutputLike { lock_args: vec![0xaa, 0xbb], type_args: None, }],};
let result = check_transaction( &FirewallConfig { registry_script, }, &tx,);
assert!(result.is_ok());What to pass in
Section titled “What to pass in”The Rust crate works with plain data structures:
ScriptLikeCellDepLikeTxOutputLikeUnsignedTxLike
That keeps the SDK easy to embed in tools or services that already have transaction data in memory.
Behavior
Section titled “Behavior”- The registry dependency must match the configured registry script exactly
- The registry payload must start with
BLKL - Blacklisted
lock_argsandtype_argsare rejected - Missing, invalid, or ambiguous registry dependencies are rejected
- Entries must be strictly sorted if you want the Rust parser to accept them
When to use it
Section titled “When to use it”Use the Rust SDK if your transaction builder, wallet tooling, or service is already Rust-based and you want the same pre-flight check that the TypeScript package provides.
If you need the live registry cell wiring first, start with How to Use.