address_version and code3 to use
for a new alt chain?Where in the database are bitcoin addresses?
A bitcoin
address is an encoding of
the hash of the public
part of a keypair in
someone's wallet.
Abe stores only the public key hash,
in pubkey.pubkey_hash. Abe converts hash values to
bitcoin addresses as needed using the hash_to_address
function in abe.py.
How do I know
what address_version and code3 to use
for a new alt chain?
code3 can be any 3 characters, e.g. "BTC"
for bitcoin. If people expect "DVC" (for example) to mean Devcoin,
use that.
For address_version, if you have a valid
address for the new chain, append it to
http://abe.john-edwin-tobey.org/q/decode_address/.
For example, Testnet address mgnQ32RSjvmTLB3jVZ9L2xUTT512cCX9b8
gives
http://abe.john-edwin-tobey.org/q/decode_address/mgnQ32RSjvmTLB3jVZ9L2xUTT512cCX9b8,
which
shows 6f:0de3da453bfd284cd1c94902dbb9bc28bbed139f. Take
the part to the left of the colon (:) (6f
for Testnet) and replace "XX" with it in "\u00XX"
("\u006f" for Testnet) That is the value
for address_version in the config file's JSON
format.
address_version comes from the first byte
of the input to SHA256 used
in address
computation. In Bitcoin as of this writing, this information is
in src/base58.h:
enum
{
PUBKEY_ADDRESS = 0,
SCRIPT_ADDRESS = 5,
PUBKEY_ADDRESS_TEST = 111,
SCRIPT_ADDRESS_TEST = 196,
};
The byte is 111 for Testnet and 0 for regular Bitcoin. You would
translate byte 111 to a JSON string as follows: 111 = '6f'
(hexadecimal). In JSON, a 1-byte string is encoded
as "\u00XX" where XX are the hex digits. So Testnet
would be "\u006f".
If you get the wrong address_version
value, everything will work except for address display. You could
look up addresses, but they would appear different on web pages.