Skip to content

sbtc: update @scure/btc-signer dependency to v2.x #1836

@pbtc21

Description

@pbtc21

Summary

The sbtc npm package (v0.3.2) uses @scure/btc-signer@^1.4.0, which is now outdated. The latest version is 2.0.1. This causes dependency conflicts when using sbtc alongside other packages that use v2.x.

Current Behavior

// sbtc package.json
"dependencies": {
  "@scure/btc-signer": "^1.4.0"  // resolves to 1.8.1
}

When installed in a project using @scure/btc-signer@2.x, npm creates nested dependencies:

node_modules/
  @scure/btc-signer/  (2.0.1 - project's version)
  sbtc/
    node_modules/
      @scure/btc-signer/  (1.8.1 - sbtc's nested version)

Bugs Found

  1. fetchSignersAddress() returns regtest format - The function hardcodes REGTEST network:

    // In api.js
    return btc.p2tr(pub, undefined, constants_1.REGTEST).address;
    // Returns: bcrt1p... instead of bc1p...
  2. fetchSbtcBalance() sometimes fails - JSON parsing errors, possibly due to API changes

Expected Behavior

  • Update @scure/btc-signer to ^2.0.0
  • Fix fetchSignersAddress() to use the correct network based on client type (Mainnet/Testnet)
  • Ensure API compatibility with current Hiro endpoints

Environment

  • sbtc version: 0.3.2
  • @scure/btc-signer (project): 2.0.1
  • @scure/btc-signer (sbtc nested): 1.8.1

Additional Context

The sbtc package was last published about a year ago. With sBTC now live on mainnet and withdrawals enabled, having an up-to-date SDK would be valuable for developers building sBTC integrations.

Related: We're building agent tooling at aibtc-mcp-server that uses both the sbtc package and @scure/btc-signer v2 for inscriptions/ordinals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions