Skip to content

feat(sdk-coin-stx): honor a statics-declared Stacks chain ID - #9828

Draft
Doddanna17 wants to merge 1 commit into
masterfrom
si-1677-bitgojs-staking-testnet
Draft

Doddanna17 wants to merge 1 commit into
masterfrom
si-1677-bitgojs-staking-testnet

Conversation

@Doddanna17

Copy link
Copy Markdown
Contributor

First slice of SI-1677 / SI-1686 for the Stacks Foundation staking-testnet (chain ID 1280 on a private Bitcoin signet).

Why

The Stacks chain ID is bytes 1-4 of a serialized transaction and is covered by the SHA-512/256 sighash, so a network with its own chain ID cannot be served by the two stock @stacks/network objects. Proven against the live node:

Built with Serialized prefix Node response
chainId=1280, version 0x80 80 00000500 NotEnoughFunds (all other validation passed)
chainId=0x80000000 (today's tstx), version 0x80 80 80000000 rejected — SignatureValidation: invalid chain ID 2147483648 (expected 1280)

What

  • statics: StacksNetwork gains optional chainId / transactionVersion; new StxStakingTestnet network (chain ID 1280, tx version 0x80) registered under Networks.test. Contract addresses verified live: pox-5 at the boot address, sbtc-withdrawal at SN3R84XZYA63QS28932XQF3G1J8R9PC3W76P9CSQS; send-many-memo is not deployed on this network, so its address is empty.
  • sdk-coin-stx: new toStacksNetwork() builds the @stacks/network object and applies a statics-declared chain identity on top of the stock mainnet/testnet network. transactionBuilder.ts uses it instead of the two-branch ternary.

stx / tstx declare neither field, so their transactions are byte-identical — asserted by the new test (8080000000 prefix) and by the existing signed-transaction fixtures.

Verification

  • New test/unit/network.ts — 5 tests pass, including serialization of prefix 8000000500 for a statics-declared chain ID.
  • Module suite: 80 passing / 7 failing, the 7 being pre-existing BITGOJS_TEST_PASSWORD environment failures (identical before this change).
  • tsc --build modules/statics clean; eslint and prettier clean on the changed files.

Not in this PR

Coin entry (needs the ticker decision — proposal tstxstk), register.ts / coinFactory / account-lib wiring, environments.ts node URL, and the three two-network maps (tokenConfig.ts:1099, sip10Token.ts:16, ofc.ts:1386,1441) — tracked in SI-1687.

Ticket: SI-1686
Refs: SI-1685, SI-1677

The Stacks chain ID is bytes 1-4 of a serialized transaction and is covered by the
sighash, so a network with its own chain ID cannot be served by the two stock
@stacks/network objects: the Stacks Foundation staking-testnet (chain ID 1280, on
a private Bitcoin signet) rejects public-testnet transactions with
"invalid chain ID 2147483648 (expected 1280)".

Statics Stacks networks may now declare chainId / transactionVersion; the SDK
applies them on top of the stock mainnet/testnet network. Both fields stay
undefined for stx / tstx, so their transactions remain byte-identical - asserted
by the new test and by the existing signed-transaction fixtures.

Adds the StxStakingTestnet network (chain ID 1280, tx version 0x80) and
toStacksNetwork(), with contract addresses verified against the live network:
pox-5 at the boot address and sbtc-withdrawal at
SN3R84XZYA63QS28932XQF3G1J8R9PC3W76P9CSQS (send-many-memo is not deployed there).

Ticket: SI-1686
Refs: SI-1685
@linear-code

linear-code Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

SI-1685

SI-1677

SI-1686

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Unit tests are failing on Node 26.x (Current release line, non-blocking). This is not an LTS version yet, so it does not block merge, but it signals an incompatibility to fix before Node 26.x becomes LTS.

View run

This branch has not been deployed

No deployments
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.

1 participant