Skip to content

Address derivation mismatch between TypeScript and Rust SDKs #132

@LastDegenBtc

Description

@LastDegenBtc

Issue: Address derivation mismatch between TypeScript and Rust SDKs

Summary

The Rust SDK derives a different Ark address than the TypeScript SDK for the same private key, causing VTXOs created via Arkade wallet to be invisible to Rust SDK users.

Environment

  • Rust SDK: arkade-os/rust-sdk (latest)
  • Network: Mainnet (arkade.computer)

Reproduction

Same nsec key produces different addresses:

SDK Address suffix (vtxo_tap_key portion)
TypeScript (Arkade wallet) ...5y3nqpqwrzefat672devsgcpv8tgjqf6xmfp8ge4c77ge4x44ae4t...
Rust SDK ...4u2786dhx27fg7fssc9ynkl6j523yaylg34hmagkdch2sqjn0sew...

Both share the same server pubkey prefix, confirming the secret key is parsed correctly.

Root Cause Analysis

The x-only pubkey derivation works correctly. The difference is in the taproot tree construction that produces the vtxo_tap_key:

  • Raw x-only pubkey: 16608a14cda9163faeb909c6f2ad05c634cee7935b57f2f9f662a6db80f78b68
  • TypeScript vtxo_tap_key: 12330040e18b29eaf5e5372c8230161d689013a36d213a335c7bc8cd4d5af735
  • Rust vtxo_tap_key: f15e3e9b732bc947930860a49dbfa951512749f446b7df5166e2ea802537c32e

The taproot tweak/tree structure differs between implementations.

Impact

  • VTXOs created via Arkade wallet cannot be queried or spent using Rust SDK
  • Users importing nsec into Rust applications see 0 balance

Workaround

Query VTXOs using the Arkade-provided address directly via get_vtxos(&[ark_address]) instead of relying on local address derivation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions