Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified LICENSE
100755 → 100644
Empty file.
Empty file modified README.md
100755 → 100644
Empty file.
Empty file modified composer.json
100755 → 100644
Empty file.
Empty file modified examples/README.md
100755 → 100644
Empty file.
Empty file modified examples/altcoin_offline_wallet.php
100755 → 100644
Empty file.
Empty file modified examples/bip32.php
100755 → 100644
Empty file.
Empty file modified examples/bip32_preparing_multisig.php
100755 → 100644
Empty file.
Empty file modified examples/bip32_sign.php
100755 → 100644
Empty file.
Empty file modified examples/bitcoin.php
100755 → 100644
Empty file.
Empty file modified examples/electrum.php
100755 → 100644
Empty file.
Empty file modified examples/electrum_address.php
100755 → 100644
Empty file.
Empty file modified examples/electrum_sign_multisig.php
100755 → 100644
Empty file.
Empty file modified examples/multisig.php
100755 → 100644
Empty file.
Empty file modified examples/prompt_sign_multisig.php
100755 → 100644
Empty file.
Empty file modified examples/raw_transaction.php
100755 → 100644
Empty file.
Empty file modified examples/sign_p2sh.php
100755 → 100644
Empty file.
Empty file modified examples/sign_p2sh_stepbystep.php
100755 → 100644
Empty file.
Empty file modified examples/signature_verification.php
100755 → 100644
Empty file.
Empty file modified examples/test_bip32.php
100755 → 100644
Empty file.
11 changes: 9 additions & 2 deletions src/BIP32.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ class BIP32
public static $litecoin_testnet_public = '0436f6e1';
public static $litecoin_testnet_private = '0436ef7d';
public static $litecoin_testnet_version = '6f';
// Monacoin
public static $monacoin_mainnet_public = '';
public static $monacoin_mainnet_private = '';
public static $monacoin_mainnet_version = '32';
public static $monacoin_testnet_public = '';
public static $monacoin_testnet_private = '';
public static $monacoin_testnet_version = '6f';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know the values for the other vars here?

or you have a BIP32 base58 encoded HD priv/pub key so we can figure them out? they're probably the same as bitcoin mainnet I guess (which result in xpriv.. and xpub.. prefixes)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it's not determined officially :(

If you are not willing to add ambiguous constants, I will remove this Monacoin part from my pullreq.
I personally feel that altcoin configuration should be supplied externally, e.g., make BIP32 class to be an abstract class, and create BIP32_Bitcoin class that extends BIP32 with proper constants defined.


/**
* Master Key
Expand Down Expand Up @@ -544,7 +551,7 @@ public static function extract_public_key($input)
* @param string $extended_key
* return string|FALSE
*/
public static function key_to_address($extended_key)
public static function key_to_address($extended_key, $address_version=null)
{
$import = self::import($extended_key);

Expand All @@ -555,7 +562,7 @@ public static function key_to_address($extended_key)
}

// Convert the public key to the address.
return BitcoinLib::public_key_to_address($public, $import['version']);
return BitcoinLib::public_key_to_address($public, $address_version!==null?$address_version:$import['version']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add spaces $address_version !== null ? $address_version : $import['version']

}

/**
Expand Down
Empty file modified src/BitcoinLib.php
100755 → 100644
Empty file.
Empty file modified src/Electrum.php
100755 → 100644
Empty file.
Empty file modified src/Jsonrpcclient.php
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion src/RawTransaction.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ public static function sign($wallet, $raw_transaction, $inputs, $magic_byte = nu
$inputs_arr = (array)json_decode($inputs);

// Generate an association of expected hash160's and related information.
$decode = self::decode($raw_transaction);
$decode = self::decode($raw_transaction, $magic_byte, $magic_p2sh_byte);

$req_sigs = 0;
$sign_count = 0;
Expand Down
Empty file modified tests/AgainstRPCTest.php
100755 → 100644
Empty file.
Empty file modified tests/BIP32CoreTest.php
100755 → 100644
Empty file.
Empty file modified tests/BIP32Test.php
100755 → 100644
Empty file.
Empty file modified tests/BitcoinLibTest.php
100755 → 100644
Empty file.
Empty file modified tests/BitcoinLibTestNetTest.php
100755 → 100644
Empty file.
Empty file modified tests/RawTransactionTest.php
100755 → 100644
Empty file.