# psbt

> Methods for working with BIP 174 PSBTs

Latest version **6.0.4** (published 2026-09-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install psbt
pnpm add psbt
yarn add psbt
bun add psbt
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 6.0.4 |
| Published | 2026-09-13 |
| First published | 2018-12-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=22 |
| Dependencies | 4 |
| Unpacked size | 414.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 42 |
| Author | Alex Bosworth |
| Maintainers | alexbosworth |

## Links

- npm: https://www.npmjs.com/package/psbt
- Repository: https://github.com/alexbosworth/psbt
- Homepage: https://github.com/alexbosworth/psbt#readme
- Issues: https://github.com/alexbosworth/psbt/issues
- npm.io page: https://npm.io/package/psbt

## Dependencies (4)

- [bip66](https://npm.io/package/bip66.md) 2.0.0
- [bitcoin-ops](https://npm.io/package/bitcoin-ops.md) 1.4.1
- [pushdata-bitcoin](https://npm.io/package/pushdata-bitcoin.md) 1.0.1
- [@alexbosworth/blockchain](https://npm.io/package/@alexbosworth/blockchain.md) 4.8.0

## Recent versions

- 6.0.4 (latest) — 2026-09-13
- 6.0.3 — 2026-09-01
- 6.0.2 — 2026-08-29
- 6.0.1 — 2026-08-28
- 6.0.0 — 2026-08-21
- 5.0.0 — 2026-02-21
- 4.0.0 — 2025-03-13
- 3.0.0 — 2023-06-28
- 2.7.2 — 2023-01-06
- 2.7.1 — 2022-07-27
- 2.7.0 — 2022-07-15
- 2.6.0 — 2022-06-09
- 2.5.0 — 2022-06-07
- 2.4.0 — 2022-06-02
- 2.3.0 — 2022-06-01
- … 23 more at https://npm.io/package/psbt/versions

## README

# PSBTs

PSBTs are a format for communicating and collaboratively working with
transactions.

The format is defined in BIP-0174:
[https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki)

## Methods

An ECPair object is required for some methods:

```node
const tinysecp = require('tiny-secp256k1');

const ECPair = await import('ecpair')

const ecp = ECPair.ECPairFactory(tinysecp);
```

### combinePsbts

Combine multiple PSBTs

    {
      ecp: <ECPair Object>
      psbts: [<BIP 174 Encoded PSBT Hex String>]
    }

    @throws
    <Combine PSBT Error>

    @returns
    {
      psbt: <BIP 174 Encoded PSBT Hex String>
    }

### createPsbt

Create a PSBT

    {
      outputs: [{
        script: <Output ScriptPub Hex String>
        tokens: <Sending Tokens Number>
      }]
      utxos: [{
        id: <Transaction Id Hex String>
        [sequence]: <Sequence Number>
        vout: <Output Index Number>
      }]
      [timelock]: <Set Lock Time on Transaction To Number>
      [version]: <Transaction Version Number>
    }

    @returns
    {
      psbt: <Partially Signed Bitcoin Transaction Hex Encoded String>
    }

### decodePsbt

Decode a BIP 174 encoded PSBT

    {
      ecp: <ECPair Object>
      psbt: <Hex Encoded Partially Signed Bitcoin Transaction String>
    }

    @throws
    <Invalid PSBT Error>

    @returns
    {
      inputs: [{
        [bip32_derivations]: [{
          fingerprint: <Public Key Fingerprint Hex String>
          [leaf_hashes]: <Taproot Leaf Hash Hex String>
          path: <BIP 32 Child / Hardened Child / Index Derivation Path String>
          public_key: <Public Key Hex String>
        }]
        [final_scriptsig]: <Final ScriptSig Hex String>
        [final_scriptwitness]: <Final Script Witness Hex String>
        [non_witness_utxo]: <Non-Witness Hex Encoded Transaction String>
        [partial_sig]: [{
          hash_type: <Signature Hash Type Number>
          public_key: <Public Key Hex String>
          signature: <Signature Hex String>
        }]
        [redeem_script]: <Hex Encoded Redeem Script String>
        [sighash_type]: <Sighash Type Number>
        [taproot_control_block]: <Taproot Script Spend Control Block Hex String>
        [taproot_leaf_hash]: <Taproot Leaf Hash Hex String>
        [taproot_leaf_public_key]: <Leaf Script X Only Public Key Hex String>
        [taproot_leaf_script]: <Taproot Leaf Spend Script Hex String>
        [taproot_leaf_version]: <Taproot Leaf Spend Script Version Number>
        [taproot_internal_key]: <X Only Taproot Internal Public Key Hex String>
        [taproot_key_spend_sig]: <Taproot Key Spend Signature Hex String>
        [taproot_root_hash]: <Taproot Merkle Root Hash Hex String>
        [taproot_script_signature]: <Taproot Script Spend Script Hex String>
        [unrecognized_attributes]: [{
          type: <Key Type Hex String>
          value: <Value Hex String>
        }]
        [witness_script]: <Witness Script Hex String>
        [witness_utxo]: {
          script_pub: <UTXO ScriptPub Hex String>
          tokens: <Tokens Number>
        }
      }]
      outputs: [{
        [bip32_derivation]: {
          fingerprint: <Public Key Fingerprint Hex String>
          [leaf_hashes]: <Taproot Leaf Hash Hex String>
          path: <BIP 32 Child/HardenedChild/Index Derivation Path Hex String>
          public_key: <Public Key Hex String>
        }
        [redeem_script]: <Hex Encoded Redeem Script>
        [taproot_internal_key]: <X Only Taproot Internal Public Key Hex String>
        [taproot_script_tree]: [{
          depth: <Tree Depth Number>
          script: <Leaf Script Hex String>
          version: <Leaf Script Version Number>
        }]
        [unrecognized_attributes]: [{
          type: <Key Type Hex String>
          value: <Value Hex String>
        }]
        [witness_script]: <Hex Encoded Witness Script>
      }]
      pairs: [{
        type: <Key Type Hex String>
        value: <Value Hex String>
      }]
      [unrecognized_attributes]: [{
        type: <Global Key Type Hex String>
        value: <Global Value Hex String>
      }]
      unsigned_transaction: <Unsigned Transaction Hex String>
    }

### encodePsbt

Encode a Partially Signed Bitcoin Transaction

    {
      pairs: [{
        [separator]: <Is Separator Bool>
        [type]: <Type Buffer Object>
        [value]: <Value Buffer Object>
      }]
    }

    @throws
    <Failed To Encode Error>

    @returns
    {
      psbt: <Hex Encoded Partially Signed Bitcoin Transaction String>
    }

### extractTransaction

Extract a transaction from a finalized PSBT

    {
      ecp: <ECPair Object>
      psbt: <BIP 174 Encoded PSBT Hex String>
    }

    @throws
    <Extract Transaction Error>

    @returns
    {
      transaction: <Hex Serialized Transaction String>
    }

### finalizePsbt

Finalize the inputs of a PSBT

    {
      ecp: <ECPair Object>
      psbt: <BIP 174 Encoded PSBT Hex String>
    }

    @throws
    <Finalize PSBT Error>

    @returns
    {
      psbt: <BIP 174 Encoded PSBT Hex String>
    }

### signPsbt

Update a PSBT with signatures

    {
      ecp: <ECPair Object>
      network: <Network Name String>
      psbt: <BIP 174 Encoded PSBT Hex String>
      signing_keys: [<WIF Encoded Private Key String>]
    }

    @throws
    <Sign PSBT Error>

    @returns
    {
      psbt: <BIP 174 Encoded PSBT Hex String>
    }

### transactionAsPsbt

Convert a signed transaction to a signed PSBT

Note: not all signed transactions can be converted to a signed PSBT. For
example, a preimage cannot be represented in a standard PSBT.

    {
      ecp: <ECPair Object>
      spending: [<Spending Transaction Hex String>]
      transaction: <Hex Encoded Transaction String>
    }

    @throws
    <Error>

    @returns
    {
      psbt: <Signed PSBT String>
    }

### updatePsbt

Update a PSBT

    {
      [additional_attributes]: [{
        type: <Type Hex String>
        value: <Value Hex String>
        vin: <Input Index Number>
        vout: <Output Index Number>
      }]
      [bip32_derivations]: [{
        fingerprint: <BIP 32 Fingerprint of Parent's Key Hex String>
        path: <BIP 32 Derivation Path String>
        public_key: <Public Key String>
      }]
      ecp: <ECPair Object>
      psbt: <BIP 174 Encoded PSBT String>
      [redeem_scripts]: [<Hex Encoded Redeem Script String>]
      [sighashes]: [{
        id: <Transaction Id String>
        sighash: <Sighash Flag Number>
        vout: <Spending Output Index Number>
      }]
      [signatures]: [{
        vin: <Signature Input Index Number>
        hash_type: <Signature Hash Type Number>
        public_key: <BIP 32 Public Key String>
        signature: <Signature Hex String>
      }]
      [taproot_inputs]: [{
        vin: <Input Index Number>
        [key_spend_sig]: <Taproot Key Spend Signature Hex String>
      }]
      [transactions]: [<Hex Encoding Transaction String>]
      [witness_scripts]: [<Witness Script String>]
    }

    @throws
    <Update PSBT Error>

    @returns
    {
      psbt: <Hex Encoded Partially Signed Bitcoin Transaction String>
    }

---
_Source: https://npm.io/package/psbt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
