dgb-wallet/packages/psbt
Digibyte.X d50286a9a5 DigiByte.X Wallet — recovery-first web wallet monorepo
Packages: core (BIP39/32/44/49/84/86 derivation, WIF), keystore (PBKDF2 +
AES-GCM), psbt, p2p (BIP157/158 SPV daemon, Dandelion++ broadcast with
relay-echo verification), blockbook, rpc, electrum, net, bns, web-ui
(React/Vite), mobile (Expo). ops/ holds the nginx vhost, systemd unit and
push.sh deploy script for digibyte.x/web.
2026-09-20 20:16:52 +02:00
..
scripts DigiByte.X Wallet — recovery-first web wallet monorepo 2026-09-20 20:16:52 +02:00
src DigiByte.X Wallet — recovery-first web wallet monorepo 2026-09-20 20:16:52 +02:00
.gitignore DigiByte.X Wallet — recovery-first web wallet monorepo 2026-09-20 20:16:52 +02:00
package.json DigiByte.X Wallet — recovery-first web wallet monorepo 2026-09-20 20:16:52 +02:00
README.md DigiByte.X Wallet — recovery-first web wallet monorepo 2026-09-20 20:16:52 +02:00
tsconfig.json DigiByte.X Wallet — recovery-first web wallet monorepo 2026-09-20 20:16:52 +02:00

@dgb-wallet/psbt

DigiByte transaction construction and signing via PSBT (BIP174).

  • buildPsbt({ inputs, outputs }) — construct an unsigned PSBT from UTXOs and outputs, BIP69 sorted by default
  • signAllInputs(psbt, keyPair) — sign every input with an ECPair; fails loudly if any input can't be signed
  • finalizeAndExtract(psbt) — after signing, produce broadcast-ready { hex, txid }
  • feeSats(psbt) / feeRateSatsPerByte(psbt) — inspect fee before broadcasting

Supports BIP44 (P2PKH), BIP49 (P2SH-P2WPKH), BIP84 (P2WPKH), BIP86 (P2TR) inputs. Depends on @dgb-wallet/core for network params.

Demo

cd "D:\Dev\SilentCode\Digibyte"
npm install    # first time only, sets up the workspace
npm run demo -w @dgb-wallet/psbt

Derives a key from the public BIP39 test seed, constructs a PSBT spending a synthetic UTXO to two outputs, signs it, and prints the raw transaction hex. The UTXO is fake so this cannot be broadcast — but every other step (derivation, PSBT construction, signature, finalization) is real and identical to what a broadcastable transaction would use. Feed a real UTXO from scantxoutset / Blockbook / Electrum-DGB and the same code produces a live transaction.

Layout

src/
  types.ts   — Utxo, Output, BuildParams shapes
  build.ts   — buildPsbt with BIP69 sorting
  sign.ts    — signAllInputs, finalizeAndExtract, fee inspection
  index.ts   — re-exports

scripts/
  build-tx-demo.ts — end-to-end seed → signed-tx demo