Skip to content

feat(sdk-coin-flpr): implement MPC support and enhance transaction signing methods#8445

Merged
mohd-kashif merged 1 commit intomasterfrom
CECHO-674
Apr 9, 2026
Merged

feat(sdk-coin-flpr): implement MPC support and enhance transaction signing methods#8445
mohd-kashif merged 1 commit intomasterfrom
CECHO-674

Conversation

@mohd-kashif
Copy link
Copy Markdown
Contributor

@mohd-kashif mohd-kashif commented Apr 8, 2026

Summary

  • Add TSS (MPC ECDSA) support to sdk-coin-flrp, making FLR the first P-chain coin in BitGoJS to support TSS
  • Enable threshold=1 signing for MPC wallets alongside existing threshold=2 multisig
  • Add addExternalSignature() for injecting MPC-produced signatures into transactions
  • Add getSignablePayload() and addSignatureToTransaction() for the MPC signing flow
  • Add MPC single-address path in isWalletAddress() validation
  • Add comprehensive MPC e2e tests for all 4 cross-chain builders (ExportInC, ExportInP, ImportInC, ImportInP)

Changes

src/flrp.ts

  • Add supportsTss() returning true and getMPCAlgorithm() returning 'ecdsa'
  • Add getSignablePayload(txHex) — returns raw bytes for MPC ceremony to sign
  • Add addSignatureToTransaction(txHex, signature) — injects MPC signature into unsigned tx
  • Update isWalletAddress() to handle MPC wallets (single address, single keychain)

src/lib/transaction.ts

  • Add addExternalSignature(signature) — fills empty credential slots with an externally-produced 65-byte ECDSA signature, works for both C-chain and P-chain transactions

src/lib/transactionBuilder.ts

  • Relax validateThreshold() to accept 1 (MPC) or 2 (multisig)

src/lib/atomicTransactionBuilder.ts

  • Update getSigningAddresses() to return 1 address for threshold=1 (MPC)

Tests (18 new MPC tests + 7 threshold/TSS tests = 25 total)

  • Each builder has a MPC signing (threshold=1) suite testing: build+sign(), build+addExternalSignature(), sign()==addExternalSignature() equivalence, deserialize+sign roundtrip
  • ExportInP additionally tests change output threshold=1 and single sigIndex
  • Threshold validation tests (accept 1/2, reject 0/3)
  • TSS declaration tests (supportsTss, getMPCAlgorithm, MPC wallet address)

Test plan

  • npx tsc --noEmit — TypeScript compiles clean
  • All 335 unit tests passing (was 317, +18 new MPC builder tests)
  • All 25 MPC-specific tests pass (--grep "MPC")
  • Existing multisig tests unaffected — threshold=2 flow unchanged
  • Verify MPC signing produces valid transactions on Coston2 testnet (follow-up)

@linear
Copy link
Copy Markdown

linear bot commented Apr 8, 2026

@mohd-kashif mohd-kashif self-assigned this Apr 8, 2026
@mohd-kashif mohd-kashif force-pushed the CECHO-674 branch 2 times, most recently from 2ec4199 to 1480f0c Compare April 8, 2026 17:02
@mohd-kashif mohd-kashif marked this pull request as ready for review April 9, 2026 08:32
@mohd-kashif mohd-kashif requested a review from a team as a code owner April 9, 2026 08:32
@mohd-kashif mohd-kashif merged commit c98a831 into master Apr 9, 2026
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants