feat(sdk-coin-stx): register tstxsignet staking-testnet coin - #9843
Merged
Merged
Conversation
Add the Stacks Foundation staking-testnet network (chain ID 1280 on a private Bitcoin signet) as the testnet-only coin tstxsignet, so BTC-backed PoX-5 staking can be tested end to end. Wallet Platform, IMS and hsm-api all consume this statics entry, which blocks the rest of the onboarding. The chain ID is bytes 1-4 of a serialized Stacks transaction and sits inside the SHA-512/256 sighash, so the existing tstx network object cannot serve this network: its node rejects such transactions with `SignatureValidation: invalid chain ID 2147483648 (expected 1280)`. - statics: optional chainId/transactionVersion on StacksNetwork; new StxSignet network (chain ID 1280, tx version 0x80, pox-5 boot and sBTC deployer contracts, both verified live); tstxsignet coin entry. - sdk-coin-stx: new toStacksNetwork() applies the statics-declared chain identity on top of the stock @stacks/network object; TransactionBuilder uses it instead of the two-branch ternary. New Tstxsignet coin class resolves the staking-testnet RPC. - Fix the three two-network maps that assumed only stx/tstx exist: statics tokenConfig (network-name switch, Erc20 precedent), sdk Sip10Token (resolve via tokenConfig.coin), and the ofc stx addressCoin default (derived from the token name). - sdk-core environments: stxSignetNodeUrl on testnet-derived envs. - Register the coin: sdk-coin-stx register, bitgo coinFactory, and the account-lib builder map. stx/tstx declare neither new field, so their transactions stay byte-identical - asserted by unit tests and guarded by the existing signed-transaction fixtures. A signed tstxsignet transfer broadcast to the live node is rejected only on funds (NotEnoughFunds), not on chain identity, which is the acceptance gate from the ticket. Ticket: CSHLD-1849 Session-Id: 139c18c0-3fc6-4b25-908d-4aed0df6dba8 Task-Id: 6215e6c5-ee49-49ad-afb0-d12bb855dfdb
Contributor
Contributor
|
|
…y switches getCoinConstructor() and getTokenConstructor() in bitgo's coinFactory.ts, and the web-demo's lazy coin loader, each had their own hardcoded stx/tstx case list that registerCoinConstructors()/register.ts didn't drive. Add tstxsignet to all three so the AMS dynamic-registration fallback path and the demo app can resolve the new coin/token the same way tstx already does. Ticket: CSHLD-1849
Contributor
|
@claude review this |
Contributor
OttoAllmendinger
approved these changes
Sep 29, 2026
veetragjain
approved these changes
Sep 29, 2026
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.

What
tstxsignet— the Stacks Foundation staking-testnet (chain ID 1280, private Bitcoin signet burnchain) — registered as a testnet-only coin, mirroring thetbtcstxsignetBTC-side pair from feat(sdk-coin-btc): register tbtcstxsignet #9832. NewStxSignetnetwork (chain ID 1280, tx version0x80, PoX-5 boot and sBTC deployer contracts, both verified live against the node) underNetworks.test.stxSignet, plus optionalchainId/transactionVersionon theStacksNetworkinterface.toStacksNetwork()applies a statics-declared chain identity on top of the stock@stacks/networkobject;TransactionBuilderuses it instead of the two-branch mainnet/testnet ternary. NewTstxsignet extends Stxcoin class resolves the staking-testnet RPC.stx/tstxexist): staticsgetSip10TokenConfignow switches on the network name (same pattern as the Erc20 config), SDKSip10Tokenresolves its base coin viatokenConfig.coin(same asErc20Token), and the ofc stxaddressCoindefault is derived from the token name.environments.ts:stxSignetNodeUrl: 'https://api.staking-testnet.hiro.so'on testnet-derived environments; thetstxsignetcoin throws a clear error in environments without it.sdk-coin-stxregister.ts, bitgocoinFactory+ coins index, and theaccount-libbuilder map.Why
BTC-backed STX PoX-5 staking must be testable end to end; the Foundation's staking-testnet bonds in ~4h vs ~8h on private-1, so it replaces private-1 as the e2e target (CSHLD-1840). This statics entry blocks the Wallet Platform, indexer (BitGo/indexer#9384) and IMS (BitGo/indexerdb-microservice#2350) slices.
The chain ID is bytes 1-4 of a serialized Stacks transaction and sits inside the SHA-512/256 sighash, so the existing
tstxnetwork object cannot serve this network — its node rejects those transactions withSignatureValidation: invalid chain ID 2147483648 (expected 1280). The chain identity therefore travels in statics instead of being implied by the network type.Builds on the closed #9828 (chain-ID slice) and the merged #9832 (
tbtcstxsignet).stx/tstxdeclare neither new field, so their transactions stay byte-identical.Test plan
sdk-coin-stx/test/unit/network.ts:toStacksNetworkkeeps the stock stx/tstx identities; atstxsignettransfer serializes with prefix80 00000500; atstxtransfer stays on80 8000 0000StxSignetdeclares chain ID 1280 / version0x80and the pox-5 + sBTC contracts; stock stx networks carry no declared chain identitySIGNED_TRANSACTIONandHOT_WALLET_TOKEN_RECOVERY_TX_HEXfixtures untouchedofcErc20Tokensfailures reproduce identically on clean master (test expects a not-yet-existingofchype:hwhypestatics coin)tstxsignettransfer broadcast tohttps://api.staking-testnet.hiro.so/v2/transactionsis rejected withNotEnoughFunds— fails only on funds, not on chain identityTicket: CSHLD-1849