You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(sdk): expose transitionHash from state transition broadcast functions #3352
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:
Broadcasting a credit transfer state transition (the actual tip)
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:
Rust SDK: Modify broadcast/broadcast_and_wait return types to include the transaction hash (hex-encoded SHA256 transaction ID)
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
Good point — you're right. The two-step approach already works:
// 1. Create + broadcast (returns StateTransition)let st = document.put_to_platform(sdk, doc_type, entropy, key, payment, signer, settings).await?;// 2. Get the hashlet tx_hash = st.transaction_id()?;// 3. Wait for confirmation separatelylet result = Document::wait_for_response(sdk, st, settings).await?;
The transaction_id() is available on StateTransition before waiting. The convenience methods (put_to_platform_and_wait_for_response, transfer_credits, etc.) hide it, but splitting into two steps gives you everything you need.
Should we close this, or is there still interest in having the convenience methods return a tuple/struct that includes the hash for DX?
It seems to me, having to manually build the st is poor dev-x
I don't understand why we wouldn't return the hash. Someone shouldn't have to jump through hoops just to find out the hash of their state transition imo. Why hide that?
For the benefit of anyone that ends up here, a partial example of a way to get hash:
import{Document,DocumentCreateTransition,BatchTransition,BatchedTransition,PrivateKey}from'@dashevo/evo-sdk';
...
// Create a new documentconstdocument=newDocument({properties: {message: `Tutorial Test @ ${newDate().toUTCString()}`,},documentTypeName: 'note',dataContractId: 'FW3DHrQiG24VqzPY4ARenMgjEPpBNuEQTZckV8hbVCG4',ownerId: identity.id,});// --- Low-level flow to get the state transition hash ---constw=awaitsdk.getWasmSdkConnected();// 1. Fetch the identity-contract nonceconstnonce=awaitw.getIdentityContractNonce(identity.id,DATA_CONTRACT_ID);constnextNonce=(nonce??0n)+1n;// 2. Create the document create transitionconstcreateTransition=newDocumentCreateTransition({
document,identityContractNonce: nextNonce,});// 3. Convert: DocumentCreateTransition → DocumentTransition → BatchedTransitionconstdocTransition=createTransition.toDocumentTransition();constbatchedTransition=newBatchedTransition(docTransition);// 4. Wrap in a BatchTransitionconstbatch=BatchTransition.fromBatchedTransitions([batchedTransition],identity.id,0,// userFeeIncrease);// 5. Convert to StateTransition and signconststateTransition=batch.toStateTransition();constprivateKey=PrivateKey.fromWIF(keyManager.keys.auth.privateKeyWif);stateTransition.sign(privateKey,identityKey);// 6. Get the hash!consttransitionHash=stateTransition.hash(false);console.log('State Transition Hash:',transitionHash);// 7. Broadcast, then wait for the result using the hashawaitsdk.stateTransitions.broadcastStateTransition(stateTransition);constresult=awaitsdk.stateTransitions.waitForStateTransitionResult(transitionHash);console.log('Result:',result.toJSON());
Ownership update: closing stale draft implementation PR #3092 and keeping this issue as the source of truth.
The PR contains useful implementation context for exposing transition hashes from SDK state-transition methods, but it has remained draft since February 2026, is now conflicting, and still carries stale requested-changes state. Since this issue already captures the product/API problem and discussion, future work should start from the current SDK surface and use #3092 as reference material rather than trying to merge the stale branch directly.
Reference PR: #3092
Last PR head recorded before close: 4e3a504f8382be1dcdaaa40d8b709e3495f3f3a0
Activity
shumkov commentedon Mar 17, 2026
You could create a state transition and then use broadcast method. In this case you have transition hash
thepastaclaw commentedon Mar 17, 2026
Good point — you're right. The two-step approach already works:
The
transaction_id()is available onStateTransitionbefore waiting. The convenience methods (put_to_platform_and_wait_for_response,transfer_credits, etc.) hide it, but splitting into two steps gives you everything you need.Should we close this, or is there still interest in having the convenience methods return a tuple/struct that includes the hash for DX?
PastaPastaPasta commentedon Mar 17, 2026
@thephez do you have thoughts on dev-x here?
It seems to me, having to manually build the st is poor dev-x
thephez commentedon Mar 17, 2026
I don't understand why we wouldn't return the hash. Someone shouldn't have to jump through hoops just to find out the hash of their state transition imo. Why hide that?
thephez commentedon Mar 17, 2026
For the benefit of anyone that ends up here, a partial example of a way to get hash:
feat(sdk): expose state transition hash from broadcast functions
thepastaclaw commentedon Jul 2, 2026
Ownership update: closing stale draft implementation PR #3092 and keeping this issue as the source of truth.
The PR contains useful implementation context for exposing transition hashes from SDK state-transition methods, but it has remained draft since February 2026, is now conflicting, and still carries stale requested-changes state. Since this issue already captures the product/API problem and discussion, future work should start from the current SDK surface and use #3092 as reference material rather than trying to merge the stale branch directly.
Reference PR: #3092
Last PR head recorded before close:
4e3a504f8382be1dcdaaa40d8b709e3495f3f3a0