mirror of
https://github.com/OneKeyHQ/bip39.git
synced 2026-04-19 00:42:17 +00:00
new Crown address format. May not be elegant solution, but bitcoinjs has limitation of network prefix length and I don't want to modify it. This approach is isolated and does not affect others
This commit is contained in:
@@ -39,7 +39,27 @@ bitcoinjs.bitcoin.networks.crown = {
|
||||
},
|
||||
pubKeyHash: 0x00,
|
||||
scriptHash: 0x05,
|
||||
wif: 0x80
|
||||
wif: 0x80,
|
||||
toNewAddress: function(oldAddress)
|
||||
{
|
||||
var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
||||
var b58 = basex(ALPHABET);
|
||||
|
||||
var addrBytes = b58.decode(oldAddress);
|
||||
|
||||
var hash160 = new Uint16Array(23);
|
||||
hash160[0]= 0x01; //C
|
||||
hash160[1]= 0x75; //R
|
||||
hash160[2]= 0x07; //W
|
||||
addrBytes.copy(hash160, 3, 1, 21);
|
||||
|
||||
var checksum = bitcoinjs.bitcoin.crypto.hash256(hash160).subarray(0, 4);
|
||||
var binaryAddr = new Uint16Array(27);
|
||||
binaryAddr.set(hash160,0);
|
||||
checksum.copy(binaryAddr, 23, 0, 4);
|
||||
var newAddress = b58.encode(binaryAddr);
|
||||
return newAddress;
|
||||
}
|
||||
};
|
||||
|
||||
bitcoinjs.bitcoin.networks.dash = {
|
||||
|
||||
Reference in New Issue
Block a user