<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 May 2013 01:59, Mark Friedenbach <span dir="ltr">&lt;<a href="mailto:mark@monetize.io" target="_blank">mark@monetize.io</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">At the developer round-table it was asked if the payment protocol would<br>
alt-chains, and Gavin noted that it has a UTF-8 encoded string<br>
identifying the network (&quot;main&quot; or &quot;test&quot;). As someone with two<br>
proposals in the works which also require chain/coin identification (one<br>
for merged mining, one for colored coins), I am opinionated on this. I<br>
believe that we need a standard mechanism for identifying chains, and<br>
one which avoids the trap of maintaining a standard registry of<br>
string-to-chain mappings.<br>
<br>
Any chain can be uniquely identified by its genesis block, 122 random<br>
bits is more than sufficient for uniquely tagging chains/colored assets,<br>
and the low-order 16-bytes of the block&#39;s hash are effectively random.<br>
With these facts in mind, I propose that we identify chains by UUID.<br>
<br>
So as to remain reasonably compliant with RFC 4122, I recommend that we<br>
use Version 4 (random) UUIDs, with the random bits extracted from the<br>
double-SHA256 hash of the genesis block of the chain. (For colored<br>
coins, the colored coin definition transaction would be used instead,<br>
but I will address that in a separate proposal and will say just one<br>
thing about it: adopting this method for identifying chains/coins will<br>
greatly assist in adopting the payment protocol to colored coins.)<br>
<br>
The following Python code illustrates how to construct the chain<br>
identifier from the serialized genesis block:<br>
<br>
     from hashlib import sha256<br>
     from uuid import UUID<br>
     def chain_uuid(serialized_genesis_block):<br>
         h = sha256(serialized_genesis_block).digest()<br>
         h = sha256(h).digest()<br>
         h = h[:16]<br>
         h = &#39;&#39;.join([<br>
             h[:6],<br>
             chr(0x40 | ord(h[6]) &amp; 0x0f),<br>
             h[7],<br>
             chr(0x80 | ord(h[8]) &amp; 0x3f),<br>
             h[9:]<br>
         ])<br>
         return UUID(bytes=h)<br>
<br>
And some example chain identifiers:<br>
<br>
     mainnet:  UUID(&#39;6fe28c0a-b6f1-4372-81a6-a246ae63f74f&#39;)<br>
     testnet3: UUID(&#39;43497fd7-f826-4571-88f4-a30fd9cec3ae&#39;)<br>
     namecoin: UUID(&#39;70c7a9f0-a2fb-4d48-a635-a70d5b157c80&#39;)<br>
<br>
As for encoding the chain identifier, the simplest method is to give<br>
&quot;network&quot; the &quot;bytes&quot; type, but defining a &quot;UUID&quot; message type is also<br>
possible. In either case bitcoin mainnet would be the default, so the<br>
extra 12 bytes (vs: &quot;main&quot; or &quot;test&quot;) would only be an issue for<br>
alt-chains or colored coins.<br></blockquote><div><br></div><div>This is essentially name spacing.  As registries grow namespaces become more important.  In bitcoin&#39;s quest for decentrality there&#39;s also the question of who maintains the registry.<br>
<br></div><div>Some out of band algo/hash could work so long as there was a one to one relationship between the described object and the UUID.  In this case the gensis block may not uniquely identify a coin.<br><br></div>
<div>The normal way to namespace a registry on the internet is to allow it to be a URI.  In this case an http style uri has the added bonus side effect that it can be dereferencable and both human and machine readable.  So yes something like org.bitcoin.* is good, just simply growing things to http style uris is cleaner, imho<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Kind regards,<br>
Mark Friedenbach<br>
<br>
------------------------------------------------------------------------------<br>
Try New Relic Now &amp; We&#39;ll Send You this Cool Shirt<br>
New Relic is the only SaaS-based application performance monitoring service<br>
that delivers powerful full stack analytics. Optimize and monitor your<br>
browser, app, &amp; servers with just a few lines of code. Try New Relic<br>
and get this awesome Nerd Life shirt! <a href="http://p.sf.net/sfu/newrelic_d2d_may" target="_blank">http://p.sf.net/sfu/newrelic_d2d_may</a><br>
_______________________________________________<br>
Bitcoin-development mailing list<br>
<a href="mailto:Bitcoin-development@lists.sourceforge.net">Bitcoin-development@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/bitcoin-development" target="_blank">https://lists.sourceforge.net/lists/listinfo/bitcoin-development</a><br>
</blockquote></div><br></div></div>