1

i looked at the link: http://brainwallet.org/

witch generate offline wallets for all major coins, i noticed that the same Passphrase generate different [Private Key&Address] pairs for eatch coin type, witch means eatch coin has a public shared id (or salt) added to the mix of the hash, am i right?

so how can i get that public coins key? and how can i edit the javascript to support other scrypt coins?

eatch time i change coin in the menu a function is called, i got that code of the page:

  PUBLIC_KEY_VERSION = parseInt($(this).attr('data-target'));
  PRIVATE_KEY_VERSION = (PUBLIC_KEY_VERSION+128)&255;
  ADDRESS_URL_PREFIX = $(this).attr('href');
 ....
    var eckey = gen_eckey;
    var compressed = gen_compressed;
    var hash_str = pad($('#hash').val(), 64, '0');   
    var hash = Crypto.util.hexToBytes(hash_str);

    var hash160 = eckey.getPubKeyHash();        
    var h160 = Crypto.util.bytesToHex(hash160);
    $('#h160').val(h160);

    var addr = new Bitcoin.Address(hash160);
    addr.version = PUBLIC_KEY_VERSION;

    $('#addr').val(addr);

when addr is the wallet address....

and the data-target for the links are:

bitcoin : 0x00
dogecoin: 0x1E
litecoin: 0x30
namecoin: 0x34
.
.
.

is this is the uniqe identifire of the coin? is if possible? it's just a single byte...

if not than what is?, and if yes how can i get the identifier of other coins, not listed (any way to extract it from the network/wallet software)?

thanks

2
  • oooh just noticed that dogecoin and datacoin has the samve publick_key_version 0x1E !
    – itai
    May 5, 2014 at 15:08
  • witch means that same dogecoin wallet address can store datacoin aswell, depanded on the network you connected to? so what is this public_key_version?, and how can i tell witch version is witch coin?
    – itai
    May 5, 2014 at 15:10

1 Answer 1

2

Yes, currencies like Bitcoin typically have a version byte that gets stored in the address which would be the PUBLIC_KEY_VERSION in the code you found.

More information here:

https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses

https://en.bitcoin.it/wiki/List_of_address_prefixes

There is another byte used for private keys as well. See:

https://en.bitcoin.it/wiki/Wallet_import_format

These bytes can't really uniquely identify a coin but they should make it harder for users to accidentally send Bitcoin to a Dogecoin address or make other mistakes like that.

3
  • thanks!, very helpful, so if a bunch of coins using the same prefix, so basically i can have the same address for all of them, like doge and datacoin? that's weird... :) , i really expeted by desgn to be some kind of a long identifier like a uuid for eatch currency...
    – itai
    May 5, 2014 at 16:35
  • Addresses currently have 20 bytes of payload data and 1 version byte. UUIDs are 16 bytes, so if you added a UUID then you would almost double the length of the address and any kind of operation you do with them (e.g. writing them down or scanning a QR code) would be harder. May 6, 2014 at 1:31
  • 1
    yes i understand, i also think because of the massive amount of coin types, there need to be a larger identifier, maby 4 bytes.. but i also know that by the original design of bitcoin no one anticipate there will be other coins... only put "version" to use as a version, not type of currency... there are collisions like datacoin & doge coin, there are only room for 255 types of currency, but there are much more now...
    – itai
    May 6, 2014 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.