BIP 122: URI scheme for Blockchain references / exploration #202

pull MarcoPon wants to merge 10 commits into bitcoin:master from MarcoPon:master changing 3 files +118 −0
  1. MarcoPon commented at 5:27 PM on September 19, 2015: contributor

    New BIP: URI scheme for Blockchain references / exploration (as discussed on bitcoin-dev mailing list). Trying to follow what @gmaxwell recently proposed on bitcoin-dev, for proposing a new BIP and obtaining a number. But I'm not so used to collaboration via Github, so apologies in advance for any "bitcointiquette" mistakes.

  2. MarcoPon renamed this:
    Create bip-MarcoPon-01.mediawiki
    BIP MarcoPon-01: URI scheme for Blockchain references / exploration
    on Sep 19, 2015
  3. luke-jr commented at 6:28 PM on September 19, 2015: member

    Please:

    1. Add a copyright section per BIP 1
    2. Tag gmaxwell (use the @ symbol before his name) to get a BIP number assigned.
    3. Update README.mediawiki
  4. MarcoPon commented at 6:58 PM on September 19, 2015: contributor

    Will do! Thanks for the assistance.

  5. luke-jr commented at 7:41 PM on September 19, 2015: member

    You forgot step 2 :P

  6. MarcoPon commented at 8:01 PM on September 19, 2015: contributor

    Oh! I added the @ tag editing the commit description above: wasn't that enough? I'll add it here for good measure then! :) @gmaxwell

  7. luke-jr added the label New BIP on Oct 23, 2015
  8. luke-jr added the label Needs number assignment on Oct 23, 2015
  9. luke-jr assigned gmaxwell on Oct 23, 2015
  10. in bip-MarcoPon-01.mediawiki:None in dd911a419a outdated
      25 | + <nowiki>blockchain:[//chain]</type/hash></nowiki>
      26 | +
      27 | +Where:
      28 | +
      29 | +;chain:
      30 | +: (optional) to uniquely point to a specific chain, the hash of the corresponding genesis block is used (see [http://https://github.com/jtimon/bitcoin/commit/3191d5e8e75687a27cf466b7a4c70bdc04809d39 Bitcoin src/chainparams.cpp]). In principle some kind of alias/mnemonic could also be used, but that is out of the scope of this BIP, and maybe could be developed in another subsequent one.
    


    jtimon commented at 11:34 AM on November 15, 2015:

    Maybe it would be worth to clarify that when this is not provided, the block explorer will default to some value. Assuming they want to default to the main bitcoin chain, they will usually default to 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f.


    jtimon commented at 11:38 AM on November 15, 2015:

    Also the link seems broken. An updated version of that commit is contained in #6382, in https://github.com/jtimon/bitcoin/commit/599019a9127abb1ada30eaf2c1e7b38e5d4239ec (but that commit will need to be rebased again as 6382's sub-PRs get merged/closed). It was once opened independently as #6230 but it is closed for now.


    MarcoPon commented at 12:21 AM on November 16, 2015:

    @jtimon Thanks for your remarks/help. In your opinion, what could be a better way to provide a reference to "where those hashes come out", for that "(see $something)" part?. The direct GitHub reference is indeed probably not the best suited one.


    jtimon commented at 2:53 PM on November 16, 2015:

    Copied from ml (awaiting moderation):

    Yes, sorry about the link. I guess you can point to #6230 . I can rebase it if needed but I would close it again because I don't want to have too many things from #6382 opened at the same time (is noisy and worse for review). My plan was to not open it independently at least until after #6907 (and actually after 0.12 assuming #6907 gets in by 0.12). But then I would maybe open a new one and reference the old one rather than reopening #6230 (which tends to be confusing). I'm not really sure what's the best answer here...but #6382 is certainly going to need rebase and the link will be broken again. Maybe one answer is to copy some text from #6230 or the commit and add it directly to the BIP instead of referencing to that commit (which will be, at least until #6907 is merged, a moving target).

  11. in bip-MarcoPon-01.mediawiki:None in dd911a419a outdated
      12 | +This BIP propose an URI scheme for looking up blocks, transactions, addresses on a Blockchain explorer, or in general to make proper Blockchain references
      13 | +
      14 | +==Motivation==
      15 | +
      16 | +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).
      17 | +Currently a Bitcoin client usually point to an arbitrary blockchain explorer when the user look for the details of a transaction (es. Bitcoin Wallet use BitEasy, Mycelium or Electrum use Blockchain.info, etc.).
    


    jtimon commented at 11:43 AM on November 15, 2015:

    Third person, s/point/points, s/look/looks.

  12. MarcoPon commented at 6:27 PM on November 18, 2015: contributor

    rebased to be up-to-date with the base branch.

  13. btcdrak commented at 12:10 PM on December 21, 2015: contributor

    Might be good to squash your commits, a little.

  14. btcdrak unassigned gmaxwell on Dec 21, 2015
  15. Created bip-MarcoPon-01.mediawiki
    URI scheme for Blockchain references / exploration
    01201d6ce5
  16. Fix broken GitHub https URL e84e2d5c38
  17. Some clarifications, typos 29b8eaef02
  18. MarcoPon force-pushed on Dec 21, 2015
  19. MarcoPon commented at 3:06 PM on December 21, 2015: contributor

    @btcdrak OK, I hope I have done it right (not very familiar with Git). Let me know if I messed up things.

  20. amacneil commented at 5:03 PM on December 21, 2015: none

    Are there any examples of native block explorers which could even handle these URIs?

    Browser support for letting websites register to handle URIs is pretty terrible, so I don't see this gaining much adoption if it's targeted purely at browsers.

  21. MarcoPon commented at 6:49 PM on December 21, 2015: contributor

    Uhm... I'm sure there's a lot of people that have associate the bitcoin: URI with Blockchain.info website, for example. Plus, probably in the future a lot of new tools may come out, as Blockchain references may be used more for proofs of various kind.

  22. Changed temporary name to bip-MarcoPon-BlockchainURI - Waiting for BIP number assignment d1f008b878
  23. MarcoPon renamed this:
    BIP MarcoPon-01: URI scheme for Blockchain references / exploration
    BIP bip-MarcoPon-BlockchainURI: URI scheme for Blockchain references / exploration
    on Dec 26, 2015
  24. in bip-MarcoPon-BlockchainURI.mediawiki:None in d1f008b878 outdated
      20 | +
      21 | +==Specification==
      22 | +
      23 | +The URI follow this simple form:
      24 | +
      25 | + <nowiki>blockchain:[//chain]</type/hash></nowiki>
    


    btcdrak commented at 5:57 PM on January 1, 2016:

    There's a flaw with the //chain genesis block to specific alt chains. Not all altcoins have a unique genesis block. For example, Feathercoin has the same genesis block as Litecoin and was a deliberate mid-chain fork. If Bitcoin were to experience a chain split into two coins, the same would be true.


    MarcoPon commented at 6:00 PM on January 1, 2016:

    Maybe in those instance the hash of the relevant first block after the fork could be used? In a sense that would be a kind of new "genesis" for that chain.


    btcdrak commented at 9:19 PM on January 1, 2016:

    That would work, but you'll have to specify it explicitly in the spec.


    MarcoPon commented at 9:22 PM on January 1, 2016:

    OK, perfect.


    jtimon commented at 10:13 AM on January 2, 2016:

    Maybe in those instance the hash of the relevant first block after the fork could be used?

    I think this is the only solution that makes sense. I think it would be good to define this hash as the chain ID to maybe used that notion in other BIPs or documentation.


    MarcoPon commented at 1:06 PM on January 2, 2016:

    So the two periods may be changed into: "(optional) to uniquely point to a specific chain, the corresponding chain ID is used (hash of genesis block, or first block after fork for forked chains)." ?


    btcdrak commented at 1:26 PM on January 2, 2016:

    You're just looking for a hash that will be unique, so really you need either the genesis or the "fork genesis" hash. If later feathercoin was to fork again, the new coin would be the next fork hash. This way you have a unique identifier for each chain. I suggest keeping exactly the same format, but just explain what //chain means, i.e. it is usually the genesis hash, but it could also be a fork hash (citing feathercoin as the example).


    MarcoPon commented at 1:28 PM on January 2, 2016:

    Yes, I already changed it to explain that, I think.


    jtimon commented at 4:26 PM on January 2, 2016:

    ACK on defining the chain ID as "the first block hash that uniquely identifies the chain, usually the hash of the genesis block, but it may be the first incompatible block for forked chains" or something of the sort. I just think it would be nice to be able to link to this BIP when someone asks "what do you mean the chain ID?". I'm fine with @MarcoPon's wording too, I'm not sure what's @btcdrak's concern with defining the chain ID (if any).

  25. MarcoPon commented at 6:07 PM on January 1, 2016: contributor

    Add some simple demo / test here: https://github.com/MarcoPon/blockchain-exploration

  26. Added clarification for forked chains. d01ba11ecc
  27. Removed specific wallet examples. 6a08c9c76a
  28. in bip-MarcoPon-BlockchainURI.mediawiki:None in 6a08c9c76a outdated
       0 | @@ -0,0 +1,80 @@
       1 | +<pre>
       2 | +  BIP: bip-MarcoPon-BlockchainURI
       3 | +  Title: URI scheme for Blockchain references / exploration
       4 | +  Author: Marco Pontello <marcopon@gmail.com>
       5 | +  Status: Draft
       6 | +  Type: Standards Track
       7 | +  Created: 29 August 2015
    


    jtimon commented at 10:08 AM on January 2, 2016:

    MarcoPon commented at 12:57 PM on January 2, 2016:

    Sure!

  29. Added Post-History. d4130aa650
  30. in bip-MarcoPon-BlockchainURI.mediawiki:None in 6a08c9c76a outdated
      26 | +
      27 | +Where:
      28 | +
      29 | +;chain:
      30 | +: (optional) to uniquely point to a specific chain, the hash of the corresponding genesis block is used (leading zeros included). For forked chains, the hash of the relevant first block after fork is used. In principle some kind of alias/mnemonic could also be used, but that is out of the scope of this BIP, and maybe could be developed in another subsequent one. If omitted (which would be the usual case), Bitcoin's mainnet is assumed. As a reference, see for example this code fragment from Bitcoin chainparams.cpp source:
      31 | +  const std::map<std::string, uint256> CChainParams::supportedChains =
    


    jtimon commented at 10:25 AM on January 2, 2016:

    This is not in chainparams.cpp (yet?), and judging from how long the requirement of introducing a factory is getting ( #6907 is just my last attempt, see #5229 for an older failed attempt), by the time something like https://github.com/jtimon/bitcoin/commit/160d874dfdb53c71a07b1bf7bdd0dab571dabefa is merged (hopefully this decade), we will probably be using c++11 (or c++14) and that boost::assign::map_list_of won't have ever touched chainparams.cpp. Maybe you can refer to that commit directly, I plan to close #6382 and replace it with something that introduces a new chain without depending on #6625 (which I have finally decided to abandon), so we won't have the "this branch will be constantly rebased" problem anymore (and #6625 was the part of #6382 that needed rebase more often). Maybe @laanwj and/or @sipa have some other suggestion?

  31. in bip-MarcoPon-BlockchainURI.mediawiki:None in d4130aa650 outdated
      26 | + <nowiki>blockchain:[//chain]</type/hash></nowiki>
      27 | +
      28 | +Where:
      29 | +
      30 | +;chain:
      31 | +: (optional) to uniquely point to a specific chain, the hash of the corresponding genesis block is used (leading zeros included). For forked chains, the hash of the relevant first block after fork is used. In principle some kind of alias/mnemonic could also be used, but that is out of the scope of this BIP, and maybe could be developed in another subsequent one. If omitted (which would be the usual case), Bitcoin's mainnet is assumed. As a reference, see for example this code fragment from Bitcoin chainparams.cpp source:
    


    btcdrak commented at 5:59 PM on January 2, 2016:

    I would drop In principle some kind of alias/mnemonic could also be used, but that is out of the scope of this BIP, and maybe could be developed in another subsequent one. it's not relevant to the specification.


    btcdrak commented at 6:05 PM on January 2, 2016:

    For forked chains, the hash of the relevant first block after fork is used.

    Drop "relevant". It is specifically the first block that diverges from the original chain onto the new fork. I would mention Feathercoin's checkpoint forking from Litecoin as an example.


    maaku commented at 2:32 PM on January 4, 2016:

    Drop the "In principle ... another subsequent one." text. It only confuses the issue.

  32. MarcoPon commented at 12:41 PM on January 4, 2016: contributor

    OK, will update the wording, and maybe add a scheme. BTW, for the chain id, how about the option of using short hashes (like in Git)?

  33. jtimon commented at 1:33 PM on January 4, 2016: contributor

    Thank you for choosing to formally define the chain ID here. About using short hashes, I imagined an attacker producing a genesis block that matches the short version of a real chain to falsify a proof in for a smart contract or something (2wp shouldn't need to refer to the genesis block, the block previous to the one when the first coins are locked in to the pegged sidechain should be enough). I don't know, there may never be a use case where the full 256 bits are needed, but I would feel better if the chain ID is defined like that. That doesn't mean that for this particular use case shorter versions of chain ID are used instead of the full ID (or optionally allowed in addition to the full ID).

  34. Reworked layout, clarified chain ID. f03c7bb90a
  35. Fixed img link. 0c7b9c4656
  36. Added Sample implementation section 2ea077022e
  37. in bip-MarcoPon-BlockchainURI.mediawiki:None in d4130aa650 outdated
      55 | + blockchain:/block/00000000000000000119af5bcae2926df54ae262e9071a94a99c913cc217cc72
      56 | +or
      57 | + blockchain:/block/372338
      58 | +
      59 | +An address on Bitcoin's mainnet:
      60 | + blockchain:/address/16EW6Rv9P9AxFDBrZV816dD4sj1EAYUX3f
    


    maaku commented at 2:33 PM on January 4, 2016:

    What about querying by scriptPubKey?


    MarcoPon commented at 2:06 AM on January 5, 2016:

    I used the items generally linked / used on block explorers, but I suppose it could be added. BTW, how about other items that may become relevant when segwit is implemented?


    afk11 commented at 1:37 PM on January 5, 2016:

    Explorers haven't offered search by scriptPubKey yet. It would be useful to some I'm sure, though even Core declined a PR for arbitrary scriptPubKey indexing.

  38. luke-jr assigned luke-jr on Jan 8, 2016
  39. luke-jr renamed this:
    BIP bip-MarcoPon-BlockchainURI: URI scheme for Blockchain references / exploration
    BIP 122: URI scheme for Blockchain references / exploration
    on Jan 8, 2016
  40. luke-jr removed the label Needs number assignment on Jan 8, 2016
  41. luke-jr merged this on Jan 8, 2016
  42. luke-jr closed this on Jan 8, 2016

  43. jtimon commented at 6:29 PM on January 11, 2016: contributor

    @MarcoPon feel free to ping me for review on new PRs with further improvements or moving it from its draft state.

  44. MarcoPon commented at 6:43 PM on January 11, 2016: contributor

    @jtimon Thank you! I'm trying to add a proper ABNF spec for the URI, then I think it should be OK. Will report back in the next few days.

  45. luke-jr referenced this in commit cf2937c811 on Apr 30, 2020

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 15:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me