Bitcoin Integration

PSBT (Partially Signed Bitcoin Transaction) signer with support for P2PKH, P2WPKH, and P2TR (Taproot).

📖 Related Documentation

Basic Usage

TY
basic-usage.ts
Loading...

Address Types

P2PKH (Legacy)

Starts with 1

Higher fees, wider compatibility

P2WPKH (SegWit)

Starts with bc1q

Lower fees, widely supported

P2TR (Taproot)

Starts with bc1p

Lowest fees, enhanced privacy

Sign PSBT

TY
sign-psbt.ts
Loading...

Advanced: Per-Input Signing

For complex PSBTs with multiple inputs, you can specify signing instructions for each input:

TY
advanced-psbt.ts
Loading...

Batch Signing

TY
batch-sign.ts
Loading...

Signer Interface

publicKey: string
addresses: { p2pkh, p2wpkh, p2tr }
signPsbt(psbt, options): Promise<BitcoinSignResult>
signAllPsbts(psbts): Promise<BitcoinSignResult[]>
getVaultId(): string
getPublicKey(): string
ownsAddress(address): boolean

Utility Functions

The auth-sdk exports helpful Bitcoin utilities:

TY
utilities.ts
Loading...

Benefits

  • • No private key exposure - Bitcoin keys stay secure in Emblem Vault
  • • All address types - P2PKH, P2WPKH, and P2TR (Taproot) support
  • • PSBT standard - Compatible with UniSat and other Bitcoin wallets
  • • Batch signing - Sign multiple PSBTs efficiently
  • • Taproot ready - Full Schnorr signature support

PSBT Workflow

Bitcoin signing with Emblem follows the PSBT (BIP 174) standard:

  1. Create a PSBT using bitcoinjs-lib or similar library
  2. Encode the PSBT to base64
  3. Sign with signer.signPsbt()
  4. Broadcast the signedTxHex to the Bitcoin network