{"number":385,"title":"raw() and addr() Output Script Descriptors","authors":["Pieter Wuille","Ava Chow"],"status":"Deployed","type":"Specification","layer":"Applications","created":"2021-06-27","license":"BSD-2-Clause","requires":[380],"replaces":[],"replacedBy":[],"discussion":[],"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.","eli5":"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.","categories":["wallets"],"filename":"bip-0385.mediawiki","githubUrl":"https://github.com/bitcoin/bips/blob/master/bip-0385.mediawiki","format":"mediawiki","readingMinutes":1,"inbound":1,"revisions":11,"impact":37,"core":false,"references":[],"lastModified":"2026-09-17","html":"<h2 id=\"abstract\">Abstract</h2>\n<p>This document specifies <code>raw()</code> and <code>addr()</code> output script descriptors. <code>raw()</code> encapsulates a raw script as a descriptor. <code>addr()</code> encapsulates an address as a descriptor.</p>\n<h2 id=\"copyright\">Copyright</h2>\n<p>This BIP is licensed under the BSD 2-clause license.</p>\n<h2 id=\"motivation\">Motivation</h2>\n<p>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.</p>\n<h2 id=\"specification\">Specification</h2>\n<p>Two new script expressions are defined: <code>raw()</code> and <code>addr()</code>.</p>\n<h3 id=\"raw\"><code>raw()</code></h3>\n<p>The <code>raw(HEX)</code> 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 <code>HEX</code>.</p>\n<h3 id=\"addr\"><code>addr()</code></h3>\n<p>The <code>addr(ADDR)</code> 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 <code>ADDR</code>.</p>\n<h2 id=\"test-vectors\">Test Vectors</h2>\n<p>Valid descriptors followed by the scripts they produce.</p>\n<ul><li>\n<code>raw(deadbeef)</code>\n<ul><li>\n<code>deadbeef</code>\n</li></ul>\n</li><li>\n<code>raw(512103a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd4104a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea23552ae)</code>\n<ul><li>\n<code>512103a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd4104a34b99f22c790c4e36b2b3c2c35a36db06226e41c692fc82b8b56ac1c540c5bd5b8dec5235a0fa8722476c7709c02559e3aa73aa03918ba2d492eea75abea23552ae</code>\n</li></ul>\n</li><li>\n<code>raw(a9149a4d9901d6af519b2a23d4a2f51650fcba87ce7b87)</code>\n<ul><li>\n<code>a9149a4d9901d6af519b2a23d4a2f51650fcba87ce7b87</code>\n</li></ul>\n</li><li>\n<code>addr(3PUNyaW7M55oKWJ3kDukwk9bsKvryra15j)</code>\n<ul><li>\n<code>a914eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee87</code>\n</li></ul>\n</li></ul>\n<p>Invalid descriptors</p>\n<ul><li>\nNon-hex script: <code>raw(asdf)</code>\n</li></ul>\n<ul><li>\nInvalid address: <code>addr(asdf)</code>\n</li></ul>\n<ul><li>\n<code>raw</code> nested in <code>sh</code>: <code>sh(raw(deadbeef))</code>\n</li></ul>\n<ul><li>\n<code>raw</code> nested in <code>wsh</code>: <code>wsh(raw(deadbeef))</code>\n</li></ul>\n<ul><li>\n<code>addr</code> nested in <code>sh</code>: <code>sh(addr(3PUNyaW7M55oKWJ3kDukwk9bsKvryra15j))</code>\n</li></ul>\n<ul><li>\n<code>addr</code> nested in <code>wsh</code>: <code>wsh(addr(3PUNyaW7M55oKWJ3kDukwk9bsKvryra15j))</code>\n</li></ul>\n<h2 id=\"backwards-compatibility\">Backwards Compatibility</h2>\n<p><code>raw()</code> and <code>addr()</code> descriptors use the format and general operation specified in <a href=\"/bip/380\">380</a>. 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.</p>\n<h2 id=\"reference-implementation\">Reference Implementation</h2>\n<p><code>raw()</code> and <code>addr()</code> descriptors have been implemented in Bitcoin Core since version 0.17.</p>","toc":[{"id":"abstract","title":"Abstract","level":2},{"id":"copyright","title":"Copyright","level":2},{"id":"motivation","title":"Motivation","level":2},{"id":"specification","title":"Specification","level":2},{"id":"raw","title":"raw()","level":3},{"id":"addr","title":"addr()","level":3},{"id":"test-vectors","title":"Test Vectors","level":2},{"id":"backwards-compatibility","title":"Backwards Compatibility","level":2},{"id":"reference-implementation","title":"Reference Implementation","level":2}],"history":{"totalCommits":11,"firstCommit":"2021-06-27T18:49:44-04:00","lastUpdated":"2026-09-17T15:03:51+02:00","events":[{"sha":"4b63b2eb99dc6f40f1793044c7add57367af9381","date":"2026-09-17T15:03:51+02:00","author":"Daniela Brozzoni","message":"bip385: Update to Specification type","url":"https://github.com/bitcoin/bips/commit/4b63b2eb99dc6f40f1793044c7add57367af9381","kind":"edit"},{"sha":"24e96e870fffaa257b465ce1f0370c14aac588e8","date":"2025-10-08T14:59:36-07:00","author":"Murch","message":"process: Created ↦ Assigned","url":"https://github.com/bitcoin/bips/commit/24e96e870fffaa257b465ce1f0370c14aac588e8","kind":"edit"},{"sha":"5207ef92a52d0b8902895b0dbb40823a4d698ec9","date":"2025-04-11T20:08:17-07:00","author":"Murch","message":"process: Author ↦ Authors","url":"https://github.com/bitcoin/bips/commit/5207ef92a52d0b8902895b0dbb40823a4d698ec9","kind":"edit"},{"sha":"59730dec4fb641a41589aa1b91d3c452f13e0e36","date":"2025-04-11T20:05:13-07:00","author":"Murch","message":"process: Remove Comments-URI and -Summary","url":"https://github.com/bitcoin/bips/commit/59730dec4fb641a41589aa1b91d3c452f13e0e36","kind":"edit"},{"sha":"5d3ceb37734f80b2ec206fc94245e3bfd6d5b0f0","date":"2025-04-11T18:08:44-07:00","author":"Murch","message":"process: Final/Active ↦ Deployed","url":"https://github.com/bitcoin/bips/commit/5d3ceb37734f80b2ec206fc94245e3bfd6d5b0f0","kind":"status"},{"sha":"bc66fdb1664781eacfa23c9077f268eb918103e2","date":"2025-06-18T14:56:02-07:00","author":"Ava Chow","message":"descriptors: Require BIP 380","url":"https://github.com/bitcoin/bips/commit/bc66fdb1664781eacfa23c9077f268eb918103e2","kind":"edit"},{"sha":"d71428ade56ad9a90e18d643eefefefb6088fbd7","date":"2024-07-10T19:02:19-04:00","author":"Ava Chow","message":"380-387: Mark basic descriptor BIPs as final","url":"https://github.com/bitcoin/bips/commit/d71428ade56ad9a90e18d643eefefefb6088fbd7","kind":"status"},{"sha":"a28b021b9933cb6b035cbb94fc1a15c30da3f6fd","date":"2023-12-13T11:12:08-05:00","author":"Ava Chow","message":"Update contact info for achow101","url":"https://github.com/bitcoin/bips/commit/a28b021b9933cb6b035cbb94fc1a15c30da3f6fd","kind":"edit"},{"sha":"bb562aa8e9c438e653668b08e5c16b7e71abc832","date":"2023-06-29T16:15:14-04:00","author":"Andrew Chow","message":"descriptors: add test vectors","url":"https://github.com/bitcoin/bips/commit/bb562aa8e9c438e653668b08e5c16b7e71abc832","kind":"edit"},{"sha":"7007dbac006b8979c352f336039a47ffe32671c5","date":"2021-09-15T09:21:09-03:00","author":"jaonoctus","message":"typo: BIP [380-385]","url":"https://github.com/bitcoin/bips/commit/7007dbac006b8979c352f336039a47ffe32671c5","kind":"edit"},{"sha":"5403ff90d69c82cb22b0a6f969f8c4ec601569b1","date":"2021-06-27T18:49:44-04:00","author":"Andrew Chow","message":"Specify BIP 385: Raw and addr descriptors","url":"https://github.com/bitcoin/bips/commit/5403ff90d69c82cb22b0a6f969f8c4ec601569b1","kind":"edit"}]}}