feat: add sdk changes for mpc tss support for TRON#8265
Open
bhuvanr159 wants to merge 1 commit intomasterfrom
Open
feat: add sdk changes for mpc tss support for TRON#8265bhuvanr159 wants to merge 1 commit intomasterfrom
bhuvanr159 wants to merge 1 commit intomasterfrom
Conversation
24b27bc to
6ac02ac
Compare
Contributor
Author
|
@claude review this PR as grug; call out only potential issues, risks, or areas for improvement (no summaries or praise), be direct and actionable, max ~500 words. |
bhavidhingra
reviewed
Mar 9, 2026
| ...txJson, | ||
| signature: signatures, | ||
| }; | ||
| return new Transaction(this._coinConfig, updatedReceipt); |
Contributor
There was a problem hiding this comment.
please check whether we need to assign it to this.transaction or not.
Contributor
Author
There was a problem hiding this comment.
No, we don't need to assign it to this.transaction. The base class build() method (in baseTransactionBuilder.ts) does not assign the result of buildImplementation() back to this.transaction , instead it simply returns it to the caller.
modules/sdk-coin-trx/src/trx.ts
Outdated
| */ | ||
| async recover(params: RecoveryOptions): Promise<RecoveryTransaction> { | ||
| async recover(params: RecoveryOptions): Promise<RecoveryTransaction | MPCTxs> { | ||
| if (params.isTss) { |
Contributor
There was a problem hiding this comment.
shouldn't we add recover related changes later when other operations are working?
TICKET: CHALO-33
6ac02ac to
aa7c01f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TICKET: CHALO-33
Summary
This PR adds MPC (Multi-Party Computation) TSS (Threshold Signature Scheme) support for Tron (TRX), enabling ECDSA-based TSS wallets alongside the existing on-chain multisig wallets.
Changes
1. Statics — Feature Flags
modules/statics/src/coinFeatures.tsCoinFeature.TSS,CoinFeature.TSS_COLD,CoinFeature.MPCV2, andCoinFeature.SHA256_WITH_ECDSA_TSStoTRX_FEATURES.MULTISIGandMULTISIG_COLDflags are retained — on-chain multisig continues to work as before.2. Transaction Layer — Signable Payload & External Signatures
modules/sdk-coin-trx/src/lib/transaction.tssignablePayloadgetter that returns the protobuf-serializedraw_databytes (raw_data_hex). This is the data that gets SHA-256 hashed and then ECDSA-signed during TSS flows.modules/sdk-coin-trx/src/lib/transactionBuilder.tsaddSignature(publicKey, signature)method to allow externally produced MPC signatures to be injected into the transaction.buildImplementation()to attach the stored signature to the transaction'ssignature[]array.modules/sdk-coin-trx/src/lib/wrappedBuilder.tsaddSignature()passthrough that delegates to the underlying builder.3. Coin Class — TSS Opt-in & Recovery
modules/sdk-coin-trx/src/trx.tssupportsTss()— returnstrue, enabling TSS wallet creation for TRX.getMPCAlgorithm()— returns'ecdsa', declaring the MPC algorithm used.getHashFunction()— returnsSHA-256, matching Tron's native hashing.getSignablePayload()— rebuilds a transaction from serialized form and returns itssignablePayload.getDefaultMultisigType()— unchanged, still returns'onchain'. Existing multisig wallets remain the default; TSS is opt-in viamultisigType: 'tss'.isWalletAddress()— extended with a TSS branch usingverifyMPCWalletAddresswithsecp256k1curve for MPC-derived address verification.recover()— extended with anisTssflag. Whentrue, delegates to the newrecoverTSS()method. Existing on-chain multisig recovery is unaffected.recoverTSS()— new method implementing TSS sweep recovery with two paths:MPCTxswithsignableHex,serializedTx,derivationPath, andcommonKeychainfor offline signing.ECDSAUtils.getMpcV2RecoveryKeyShares, signs the SHA-256 hash of thesignablePayloadusingECDSAUtils.signRecoveryMpcV2, and attaches the resulting signature to produce a broadcastable transaction.createBroadcastableSweepTransaction()— new method that reassembles OVC-signed transactions. Parses the ECDSA signature (recid:r:s:y), derives the public key from the common keychain, constructs the 65-byte Tron signature (r + s + v), and attaches it to the transaction.auditDecryptedKey()— new method for TSS key auditing usingauditEcdsaPrivateKey.4. Dependency
modules/sdk-coin-trx/package.json@bitgo/sdk-lib-mpcas a dependency (required forauditEcdsaPrivateKey).5. Test Fixture Update
modules/statics/test/unit/fixtures/expectedColdFeatures.tstrxandttrxfrom thejustMultiSiglist to theboth(multisig + TSS cold) list, reflecting the new feature flags.Backward Compatibility
getDefaultMultisigType()still returns'onchain'— existing wallet creation defaults are unchanged.recover()only enters the TSS path whenisTss: trueis explicitly passed.isWalletAddress()only uses TSS verification when TSS-specific params are provided.