Skip to content

Commit

Permalink
Reworked layout, clarified chain ID.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPon committed Jan 5, 2016
1 parent d4130aa commit f03c7bb
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 21 deletions.
69 changes: 48 additions & 21 deletions bip-MarcoPon-BlockchainURI.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,73 @@ The same happens with posts and messages that reference some particular txs or b

==Specification==

The URI follow this simple form:
The URI follow this form:

<nowiki>blockchain:[//chain]</type/hash></nowiki>
Where:

;chain:
: (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:
const std::map<std::string, uint256> CChainParams::supportedChains =
boost::assign::map_list_of
( "main", uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"))
( "test", uint256S("0x000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"))
( "regtest", uint256S("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"))
;
{| class="wikitable"
! style="text-align: center;" | Element
! colspan="2" style="text-align: center;" | Description
!
|-
| chain
| colspan="2" | '''chain ID''' (see below) of the desired chain, leading 0s included. If omitted (which would be the usual case), Bitcoin main net is assumed.
| optional
|-
| rowspan="3" | type
| tx
| for transactions.
| rowspan="3" |
|-
| block
| for blocks (supports both hash or height).
|-
| address
| for addresses.
|-
| hash
| colspan="2" | the relevant hash to refer to (leading zeros included), or block height.
|
|}

----
===Definition of chain ID===

The '''chain ID''' 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.

So, for example:
<pre>
Bitcoin main : 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f
Bitcoin test : 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943
Bitcoin regtest: 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206
</pre>

An example of forked chain (Feathercoin, that forked Litecoin):

<img src=chainid.png></img>

;type:
: '''tx''': for transactions.
: '''block''': for blocks (supports both hash or height).
: '''address''': for addresses.
<pre>
Litecoin : 12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2
Feathercoin: fdbe99b90c90bae7505796461471d89ae8388ab953997aa06a355bbda8d915cb
</pre>

;hash:
: the relevant hash to refer to (leading zeros included), or block height.

==Examples==

A transaction on Bitcoin's mainnet:
A transaction on Bitcoin main net:
blockchain:/tx/b462ae6eb8bdae2e060239a2a3ea5d9c3e0f9ef34d9717beb2dcf0ed42cee7da

A block on Bitcoin's mainnet:
A block on Bitcoin main net:
blockchain:/block/00000000000000000119af5bcae2926df54ae262e9071a94a99c913cc217cc72
or
blockchain:/block/372338

An address on Bitcoin's mainnet:
An address on Bitcoin main net:
blockchain:/address/16EW6Rv9P9AxFDBrZV816dD4sj1EAYUX3f

A transaction on Bitcoin's testnet:
A transaction on Bitcoin test net:
blockchain://000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943/tx/3b95a766d7a99b87188d6875c8484cb2b310b78459b7816d4dfc3f0f7e04281a

==Rationale==
Expand All @@ -77,5 +105,4 @@ Thanks to Richard Moore, Matt Whitlock, Andreas Schildbach for suggestions about

==Copyright==

This document is placed in the public domain.

This document is placed in the public domain.
Binary file added bip-MarcoPon-BlockchainURI/chainid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f03c7bb

Please sign in to comment.