Bit-Wasp/bitcoin-lib-php — pull request #26 by rubensayshi (2014-11-06 11:54:51+00:00)
Title: Magic Byte

I made this PR a while back already, but to my own repo so you never got to see it :/

I've tried a few different aproaches, but even when I was willing to break backwards compatability it was a pain in the ass to do this in a nice way without static methods and all ...
So static methods it is!

you can control the defaults in the following ways:
```php
BitcoinLib::setMagicByte('bitcoin'); // alias for the 00|05
BitcoinLib::setMagicByte('00|05');
BitcoinLib::setMagicByte('bitcoin-testnet'); // alias for the 6f|c4
BitcoinLib::setMagicByte('6f|c4');
```

All methods still have their `$address_version` argument that they previously already had, except it defaults to `NULL` and `BitcoinLib::magicByte($address_version);` is always called to normalize it.
and `BitcoinLib::magicP2SHByte($p2sh_address_version);` is used to normalize the p2sh byte.

I added `BitcoinLibTestNetTest` extending the original `BitcoinLibTest` so that it will run the same tests but with different fixtures.

The only remaining 'hardcoded' address byte is left in `BIP32` in the constants, which are used by `BIP32::describe_magic_bytes`, which afaik is okay for now ...

I'm not entirely sure about the private key version yet ...
For example `BIP32::calc_address_bytes` does an XOR with `0x80000000`, that's got nothing to do with the address version right?
And neither does `BIP30::get_address_number` right?