Home › Topics › Wallets › BIP 385

BIP 385: raw() and addr() Output Script Descriptors

Also known as: BIP385, BIP-0385.

In plain English: Defines two simple descriptor functions: one that wraps an arbitrary raw script and one that wraps a plain address. They let wallets track coins in formats not otherwise covered, or watch an address without knowing the keys behind it.

Status
Deployed
Type
Specification
Layer
Applications
Authors
Pieter Wuille, Ava Chow
Assigned
Last changed
Requires
BIP 380
Topics
Wallets
Source
bip-0385.mediawiki on GitHub · Markdown

Full specification

Abstract

This document specifies raw() and addr() output script descriptors. raw() encapsulates a raw script as a descriptor. addr() encapsulates an address as a descriptor.

This BIP is licensed under the BSD 2-clause license.

Motivation

In order to make descriptors maximally compatible with scripts in use today, it is useful to be able to wrap any arbitrary output script or an address into a descriptor.

Specification

Two new script expressions are defined: raw() and addr().

raw()

The raw(HEX) expression can only be used as a top level descriptor. As the argument, it takes a hex string representing a Bitcoin script. The output script produced by this descriptor is the script represented by HEX.

addr()

The addr(ADDR) expression can only be used as a top level descriptor. It takes an address as its single argument. The output script produced by this descriptor is the output script produced by the address ADDR.

Test Vectors

Valid descriptors followed by the scripts they produce.

  • raw(deadbeef)
    • deadbeef
  • raw(512103a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd4104a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea23552ae)
    • 512103a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd4104a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea23552ae
  • raw(a9149a4d9901d6af519b2a23d4a2f51650fcba87ce7b87)
    • a9149a4d9901d6af519b2a23d4a2f51650fcba87ce7b87
  • addr(3PUNyaW7M55oKWJ3kDukwk9bsKvryra15j)
    • a914eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee87

Invalid descriptors

  • Non-hex script: raw(asdf)
  • Invalid address: addr(asdf)
  • raw nested in sh: sh(raw(deadbeef))
  • raw nested in wsh: wsh(raw(deadbeef))
  • addr nested in sh: sh(addr(3PUNyaW7M55oKWJ3kDukwk9bsKvryra15j))
  • addr nested in wsh: wsh(addr(3PUNyaW7M55oKWJ3kDukwk9bsKvryra15j))

Backwards Compatibility

raw() and addr() descriptors use the format and general operation specified in 380. As this is a wholly new descriptor, it is not compatible with any implementation. The reuse of existing Bitcoin addresses allows for this to be more easily implemented.

Reference Implementation

raw() and addr() descriptors have been implemented in Bitcoin Core since version 0.17.

Questions about BIP 385

What is BIP 385?

BIP 385, “raw() and addr() Output Script Descriptors”, is a specification Bitcoin Improvement Proposal written by Pieter Wuille and Ava Chow and assigned in June 2021. Defines two simple descriptor functions: one that wraps an arbitrary raw script and one that wraps a plain address. They let wallets track coins in formats not otherwise covered, or watch an address without knowing the keys behind it.

Is BIP 385 active?

Yes. BIP 385 has the status Deployed, which means it is live: adopted by the Bitcoin network or by widely used software.

Who wrote BIP 385?

BIP 385 was written by Pieter Wuille and Ava Chow. Its number was assigned on June 27, 2021.

What does BIP 385 build on?

BIP 385 requires BIP 380 (Output Script Descriptors General Operation). Read it first to understand this proposal.

Which BIPs build on BIP 385?

1 other BIP references BIP 385: BIP 380 (Output Script Descriptors General Operation).

Where can I read the full BIP 385 specification?

The complete text of BIP 385 is on this page, taken unchanged from the official bitcoin/bips repository on GitHub. It is also available as Markdown and JSON.

BIPs that build on BIP 385

  • BIP 380: Output Script Descriptors General Operation: Deployed. Output script descriptors are a compact text language for describing exactly which addresses a wallet owns and how they are spent. This document defines their general syntax and checksum, giving…

Learn more

Guides

Glossary

Related proposals