{"number":122,"title":"URI scheme for Blockchain references / exploration","authors":["Marco Pontello"],"status":"Draft","type":"Specification","layer":"Applications","created":"2015-08-29","license":"PD","requires":[],"replaces":[],"replacedBy":[],"discussion":["https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-August/010712.html"],"abstract":"This BIP proposes a URI scheme for looking up blocks, transactions and addresses on a Blockchain explorer, or in general to make proper Blockchain references.","eli5":"Proposes a standard link format for referring to blocks, transactions and addresses, which software can open in any blockchain explorer the user chooses. It also lets the link specify which blockchain is meant, avoiding ambiguity between networks.","categories":["standards","uri"],"filename":"bip-0122.mediawiki","githubUrl":"https://github.com/bitcoin/bips/blob/master/bip-0122.mediawiki","format":"mediawiki","readingMinutes":2,"inbound":1,"revisions":18,"impact":55,"core":false,"references":[],"lastModified":"2025-10-08","html":"<h2 id=\"abstract\">Abstract</h2>\n<p>This BIP proposes a URI scheme for looking up blocks, transactions and addresses on a Blockchain explorer, or in general to make proper Blockchain references.</p>\n<h2 id=\"motivation\">Motivation</h2>\n<p>The purpose of this URI scheme is to enable users to handle all the requests for details about blocks, transactions, etc. with their preferred tool (being that a web service or a local application). Currently a Bitcoin client usually points to an arbitrary blockchain explorer when the user looks for the details of a transaction or allows the user to choose from a set of alternatives. Resorting to copy + paste into a browser is often required. The same happens with posts and messages that reference some particular txs or blocks, if they provide links at all.</p>\n<h2 id=\"specification\">Specification</h2>\n<p>The URI follow this form:</p>\n<pre><code>&lt;nowiki&gt;blockchain:[//&lt;chain&gt;]/&lt;tx|block|address&gt;/&lt;hash&gt;&lt;/nowiki&gt;</code></pre>\n<p>Where:</p>\n<div class=\"table-wrap\"><table><tbody><tr><th style=\"text-align: center;\">Element</th><th colspan=\"2\" style=\"text-align: center;\">Description</th><th>Required?</th></tr><tr><td>chain</td><td colspan=\"2\"><strong>chain ID</strong> (see below) of the desired chain, leading 0s included. If omitted (which would be the usual case), Bitcoin main net is assumed.</td><td>optional</td></tr><tr><td rowspan=\"3\">type</td><td>tx</td><td>for transactions.</td><td rowspan=\"3\">required</td></tr><tr><td>block</td><td>for blocks (supports both hash or height).</td></tr><tr><td>address</td><td>for addresses.</td></tr><tr><td>hash</td><td colspan=\"2\">the relevant hash to refer to (leading zeros included), or block height.</td><td>required</td></tr></tbody></table></div>\n<h4 id=\"abnf-grammar\">ABNF grammar</h4>\n<pre><code>blockchainuri = \"blockchain:\" [\"//\" chain] \"/\" object\nobject = (\"tx\" \"/\" hash) / (\"block\" \"/\" (hash / blockheight)) /\n         (\"address\" \"/\" address)\nchain = hash\nhash = 64HEXDIG\nblockheight = 1*15DIGIT ; 15 is somehow arbitrary, i.e. a \"small\" int.\naddress = base58 ; https://en.wikipedia.org/wiki/Base58</code></pre>\n<hr />\n<h3 id=\"definition-of-chain-id\">Definition of chain ID</h3>\n<p>The <strong>chain ID</strong> of a chain is the block hash of the corresponding genesis block. For forked chains, it's the block hash of the first block after fork.</p>\n<p>So, for example:</p>\n<pre><code>Bitcoin main   : 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f\nBitcoin test   : 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943\nBitcoin regtest: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206</code></pre>\n<p>An example of forked chain (Feathercoin, that forked Litecoin):</p>\n<img src=\"https://raw.githubusercontent.com/bitcoin/bips/master/bip-0122/chainid.png\"></img>\n<pre><code>Litecoin   : 12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2\nFeathercoin: fdbe99b90c90bae7505796461471d89ae8388ab953997aa06a355bbda8d915cb</code></pre>\n<h2 id=\"examples\">Examples</h2>\n<p>A transaction on Bitcoin main net:</p>\n<pre><code>blockchain:/tx/b462ae6eb8bdae2e060239a2a3ea5d9c3e0f9ef34d9717beb2dcf0ed42cee7da</code></pre>\n<p>A block on Bitcoin main net:</p>\n<pre><code>blockchain:/block/00000000000000000119af5bcae2926df54ae262e9071a94a99c913cc217cc72</code></pre>\n<p>or</p>\n<pre><code>blockchain:/block/372338</code></pre>\n<p>An address on Bitcoin main net:</p>\n<pre><code>blockchain:/address/16EW6Rv9P9AxFDBrZV816dD4sj1EAYUX3f</code></pre>\n<p>A transaction on Bitcoin test net:</p>\n<pre><code>blockchain://000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943/tx/3b95a766d7a99b87188d6875c8484cb2b310b78459b7816d4dfc3f0f7e04281a</code></pre>\n<h2 id=\"rationale\">Rationale</h2>\n<p>From the point of view of a wallet (or other Blockchain related tool) developers which need to reference Blockchain data, using this scheme mean that he can simply make it a `blockchain:` link without having to worry about any specific Blockchain explorer or provide a means for the user to select one.</p>\n<p>Blockchain explorers in turn will simply offer to handle the `blockchain:` URI schema, the first time the user visit their website, or launch/install the application, or even set themselves if there isn't already one.</p>\n<p>Users can link directly to their preferred block explorer (avoiding copy + paste which can be awkward on mobile devices).</p>\n<h2 id=\"sample-implementation\">Sample implementation</h2>\n<p><a href=\"https://github.com/MarcoPon/blockchain-exploration\">Demo Blockchain: URI handler on GitHub</a></p>\n<h2 id=\"acknowledgements\">Acknowledgements</h2>\n<p>Thanks to Btc Drak for suggesting support for different networks and Jorge Timon for the suggestion that we could identify each network by its genesis block hash. Thanks to Richard Moore, Matt Whitlock, Andreas Schildbach for help with the structure and hierarchy of the URI scheme.</p>\n<h2 id=\"copyright\">Copyright</h2>\n<p>This document is placed in the public domain.</p>","toc":[{"id":"abstract","title":"Abstract","level":2},{"id":"motivation","title":"Motivation","level":2},{"id":"specification","title":"Specification","level":2},{"id":"abnf-grammar","title":"ABNF grammar","level":4},{"id":"definition-of-chain-id","title":"Definition of chain ID","level":3},{"id":"examples","title":"Examples","level":2},{"id":"rationale","title":"Rationale","level":2},{"id":"sample-implementation","title":"Sample implementation","level":2},{"id":"acknowledgements","title":"Acknowledgements","level":2},{"id":"copyright","title":"Copyright","level":2}],"history":{"totalCommits":18,"firstCommit":"2015-10-16T20:10:54-07:00","lastUpdated":"2025-10-08T14:59:36-07:00","events":[{"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":"01352f7f40cb7f61d0aa177341f8804de2f8fed9","date":"2025-04-11T20:07:37-07:00","author":"Murch","message":"process: Post-History ↦ Discussion","url":"https://github.com/bitcoin/bips/commit/01352f7f40cb7f61d0aa177341f8804de2f8fed9","kind":"edit"},{"sha":"a233bde4af52c6a11269e2e6dd9707abce441ffe","date":"2025-04-11T18:19:21-07:00","author":"Murch","message":"process: Standards Track ↦ Specification","url":"https://github.com/bitcoin/bips/commit/a233bde4af52c6a11269e2e6dd9707abce441ffe","kind":"edit"},{"sha":"9a56d3544eac1f949a747c251810f7a440d63fb9","date":"2024-07-25T18:35:39+03:00","author":"Orfeas Stefanos Thyfronitis Litos","message":"Remove trailing whitespace from all BIPs","url":"https://github.com/bitcoin/bips/commit/9a56d3544eac1f949a747c251810f7a440d63fb9","kind":"edit"},{"sha":"959fecc15bdad070afa63455468b1dba54655fa6","date":"2016-11-30T09:47:31+00:00","author":"Luke Dashjr","message":"Promote BIP 2 Draft->Active, and implement it","url":"https://github.com/bitcoin/bips/commit/959fecc15bdad070afa63455468b1dba54655fa6","kind":"status"},{"sha":"72f18918a8ae655212ea2700b30f0dc4d758b843","date":"2016-11-30T09:45:33+00:00","author":"Luke Dashjr","message":"Promote BIP 123 Draft->Active, and implement it","url":"https://github.com/bitcoin/bips/commit/72f18918a8ae655212ea2700b30f0dc4d758b843","kind":"status"},{"sha":"4edd6d2badd9a6ad2ff09bb6792fe0d0e365a7de","date":"2016-02-03T07:02:36+00:00","author":"Luke Dashjr","message":"Lots of formatting fixes","url":"https://github.com/bitcoin/bips/commit/4edd6d2badd9a6ad2ff09bb6792fe0d0e365a7de","kind":"edit"},{"sha":"6d701a3ea852e908ef2d308fb5bf8ef14bd2d6e8","date":"2016-01-24T16:47:40+01:00","author":"Jonathan Cross","message":"Improvements to BIP 122","url":"https://github.com/bitcoin/bips/commit/6d701a3ea852e908ef2d308fb5bf8ef14bd2d6e8","kind":"edit"},{"sha":"628a851062abbad73df8f48e3cd45dcffbdec914","date":"2016-01-12T19:09:57+01:00","author":"MarcoPon","message":"More consistent spacing.","url":"https://github.com/bitcoin/bips/commit/628a851062abbad73df8f48e3cd45dcffbdec914","kind":"edit"},{"sha":"07b73c67dfa99cb13bf9e95dbbc3cad8d938936a","date":"2016-01-12T16:46:52+01:00","author":"Marco Pontello","message":"added ABNF grammar","url":"https://github.com/bitcoin/bips/commit/07b73c67dfa99cb13bf9e95dbbc3cad8d938936a","kind":"edit"},{"sha":"8380abd7eb1177365a131254e0c373e09d2b5371","date":"2016-01-08T17:45:00+00:00","author":"Luke Dashjr","message":"Assign BIP 122","url":"https://github.com/bitcoin/bips/commit/8380abd7eb1177365a131254e0c373e09d2b5371","kind":"edit"},{"sha":"3a41325f81e50c4d90cc04c5dec4c6f8b9ac6233","date":"2015-12-30T15:54:33-08:00","author":"Chris Priest","message":"removed old bip","url":"https://github.com/bitcoin/bips/commit/3a41325f81e50c4d90cc04c5dec4c6f8b9ac6233","kind":"edit"},{"sha":"478c14dc171a448bc5f216d34b4a39e3ad6ac1ed","date":"2015-10-16T20:14:57-07:00","author":"Chris Priest","message":"more typos","url":"https://github.com/bitcoin/bips/commit/478c14dc171a448bc5f216d34b4a39e3ad6ac1ed","kind":"edit"},{"sha":"6447c8df9e25df04e0e1b233a2fc69d61bb9fb4f","date":"2015-10-16T20:14:09-07:00","author":"Chris Priest","message":"more typos","url":"https://github.com/bitcoin/bips/commit/6447c8df9e25df04e0e1b233a2fc69d61bb9fb4f","kind":"edit"},{"sha":"029bd7d178fb3f163de17cd1a1b16286190ec696","date":"2015-10-16T20:11:56-07:00","author":"Chris Priest","message":"typos","url":"https://github.com/bitcoin/bips/commit/029bd7d178fb3f163de17cd1a1b16286190ec696","kind":"edit"},{"sha":"451260d6d906a8372675d39cd36e9a97aec089ce","date":"2015-10-16T20:10:54-07:00","author":"Chris Priest","message":"added bip122","url":"https://github.com/bitcoin/bips/commit/451260d6d906a8372675d39cd36e9a97aec089ce","kind":"edit"}]}}