Sui.

Post

Share your knowledge.

MOT.
MOT40
Sep 20, 2025
Expert Q&A

Gas-Efficient Hierarchical Data Storage

What’s the recommended pattern for gas-efficient storage of complex hierarchical data (e.g., identity trees) in Sui using Move structs?

  • Sui
  • Architecture
  • SDKs and Developer Tools
  • NFT Ecosystem
  • Move
0
1
Share
Comments
.

Answers

1
LOLLYPOP.
Sep 25 2025, 03:52

I think the most scalable pattern is to use intermediate claim tickets instead of direct locking during migration. Instead of moving the asset directly across shards, the source shard burns the asset and issues a ClaimCap that is only redeemable once on the destination shard. This avoids object contention, because the source asset is permanently invalidated.

Here’s a Move pattern I’ve used:

module cross_shard::bridge {

    struct ClaimCap has key {
        id: UID,
        asset_type: vector<u8>,
        amount: u64,
        receiver: address,
    }

    // Source shard burns asset and issues ClaimCap
    public entry fun export_asset(asset: Coin<SUI>, receiver: address, ctx: &mut TxContext): ClaimCap {
        let amount = coin::value(&asset);
        coin::burn(asset);
        ClaimCap { id: object::new(ctx), asset_type: b"SUI", amount, receiver }
    }

    // Destination shard redeems ClaimCap
    public entry fun import_asset(cap: ClaimCap, ctx: &mut TxContext): Coin<SUI> {
        let coin = coin::mint<SUI>(cap.amount, ctx);
        object::delete(cap);
        coin
    }
}

This way, migration doesn’t block or hold cross-shard locks. Each shard processes its part independently, but consistency is guaranteed since the ClaimCap can’t be reused.

0
Comments
.

Do you know the answer?

Please log in and share it.