Skip to content

feat(sdk): expose transitionHash from state transition broadcast functions #3352

@thepastaclaw

Description

@thepastaclaw

Summary

State transition functions (in both Rust SDK and WASM SDK) compute transaction hashes internally but never expose them to callers. This makes it impossible to reference or link state transitions to each other — a fundamental composability primitive.

Use Case

In Yappr (decentralized blog on Platform), tipping works by:

  1. Broadcasting a credit transfer state transition (the actual tip)
  2. Creating a document (tip receipt) that references both the credit transfer transition hash AND the post being replied to

Without the transition hash being returned from step 1, there is no way to create a verifiable link between "this document" and "that payment." Anyone should be able to take the transitionHash from the tip document, fetch the actual state transition, and confirm the credits were sent.

This pattern applies broadly: receipts, escrow references, audit trails, any cross-transition linkage.

Proposed Approach

Per review feedback on platform#2953, this should be implemented in the Rust SDK first, with the WASM SDK inheriting it as a thin wrapper:

  1. Rust SDK: Modify broadcast/broadcast_and_wait return types to include the transaction hash (hex-encoded SHA256 transaction ID)
  2. WASM SDK: Surface the Rust SDK return values through the JS bindings

Prior Art

  • platform#2953 implemented this directly in WASM SDK for all 22 state transition functions
  • Reviewer feedback (shumkov): should go through Rust SDK first, WASM SDK should stay thin
  • Pushed to 3.1 milestone by QuantumExplorer for further discussion

Scope

All state transition categories need this:

  • Identity (5 functions): create, topUp, creditTransfer, creditWithdrawal, update
  • Tokens (10 functions): mint, burn, transfer, freeze, unfreeze, destroyFrozen, etc.
  • Contracts (2 functions): create, update
  • Documents (6 functions): create, replace, delete, transfer, purchase, setPrice

Related: platform#2953 (being closed, concept preserved here)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions