From b04f3fb66382b547a60725a7a6a03bdd8ed7481d Mon Sep 17 00:00:00 2001 From: Vis Virial Date: Sat, 22 Nov 2014 15:14:00 +0900 Subject: [PATCH 1/3] modified for Monacoin use. --- src/BIP32.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/BIP32.php b/src/BIP32.php index c0cbcef..cc866ac 100755 --- a/src/BIP32.php +++ b/src/BIP32.php @@ -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'; /** * Master Key @@ -489,7 +496,7 @@ public static function extract_public_key($input) * @param string $address_version * 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); if ($import['type'] == 'public') { @@ -501,7 +508,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']); } /** From cf203a84b0814ee42f57615eb9491d01d1e338a5 Mon Sep 17 00:00:00 2001 From: Vis Virial Date: Wed, 10 Dec 2014 21:31:21 +0900 Subject: [PATCH 2/3] fix for custom version byte. --- src/RawTransaction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RawTransaction.php b/src/RawTransaction.php index 292b7a1..5093818 100755 --- a/src/RawTransaction.php +++ b/src/RawTransaction.php @@ -1067,7 +1067,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; From e31b242ee18b2ca9a90fcf99f3eb0f9214374da4 Mon Sep 17 00:00:00 2001 From: Vis Virial Date: Wed, 10 Dec 2014 21:32:10 +0900 Subject: [PATCH 3/3] fix permissions. --- LICENSE | 0 README.md | 0 composer.json | 0 example.php | 0 examples/README.md | 0 examples/altcoin_offline_wallet.php | 0 examples/bip32.php | 0 examples/bip32_preparing_multisig.php | 0 examples/bip32_sign.php | 0 examples/bitcoin.php | 0 examples/electrum.php | 0 examples/electrum_sign_multisig.php | 0 examples/multisig.php | 0 examples/order_multisig.php | 0 examples/prompt_sign_multisig.php | 0 examples/raw_transaction.php | 0 examples/sign_p2sh.php | 0 examples/sign_p2sh_stepbystep.php | 0 examples/signature_verification.php | 0 examples/test_bip32.php | 0 phpunit.xml | 0 src/BIP32.php | 0 src/BitcoinLib.php | 0 src/Electrum.php | 0 src/Jsonrpcclient.php | 0 src/RawTransaction.php | 0 tests/AgainstRPCTest.php | 0 tests/BIP32CoreTest.php | 0 tests/BIP32Test.php | 0 tests/BitcoinLibTest.php | 0 tests/BitcoinLibTestNetTest.php | 0 tests/RawTransactionTest.php | 0 tests/testElectrum.php | 0 33 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 LICENSE mode change 100755 => 100644 README.md mode change 100755 => 100644 composer.json mode change 100755 => 100644 example.php mode change 100755 => 100644 examples/README.md mode change 100755 => 100644 examples/altcoin_offline_wallet.php mode change 100755 => 100644 examples/bip32.php mode change 100755 => 100644 examples/bip32_preparing_multisig.php mode change 100755 => 100644 examples/bip32_sign.php mode change 100755 => 100644 examples/bitcoin.php mode change 100755 => 100644 examples/electrum.php mode change 100755 => 100644 examples/electrum_sign_multisig.php mode change 100755 => 100644 examples/multisig.php mode change 100755 => 100644 examples/order_multisig.php mode change 100755 => 100644 examples/prompt_sign_multisig.php mode change 100755 => 100644 examples/raw_transaction.php mode change 100755 => 100644 examples/sign_p2sh.php mode change 100755 => 100644 examples/sign_p2sh_stepbystep.php mode change 100755 => 100644 examples/signature_verification.php mode change 100755 => 100644 examples/test_bip32.php mode change 100755 => 100644 phpunit.xml mode change 100755 => 100644 src/BIP32.php mode change 100755 => 100644 src/BitcoinLib.php mode change 100755 => 100644 src/Electrum.php mode change 100755 => 100644 src/Jsonrpcclient.php mode change 100755 => 100644 src/RawTransaction.php mode change 100755 => 100644 tests/AgainstRPCTest.php mode change 100755 => 100644 tests/BIP32CoreTest.php mode change 100755 => 100644 tests/BIP32Test.php mode change 100755 => 100644 tests/BitcoinLibTest.php mode change 100755 => 100644 tests/BitcoinLibTestNetTest.php mode change 100755 => 100644 tests/RawTransactionTest.php mode change 100755 => 100644 tests/testElectrum.php diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 diff --git a/example.php b/example.php old mode 100755 new mode 100644 diff --git a/examples/README.md b/examples/README.md old mode 100755 new mode 100644 diff --git a/examples/altcoin_offline_wallet.php b/examples/altcoin_offline_wallet.php old mode 100755 new mode 100644 diff --git a/examples/bip32.php b/examples/bip32.php old mode 100755 new mode 100644 diff --git a/examples/bip32_preparing_multisig.php b/examples/bip32_preparing_multisig.php old mode 100755 new mode 100644 diff --git a/examples/bip32_sign.php b/examples/bip32_sign.php old mode 100755 new mode 100644 diff --git a/examples/bitcoin.php b/examples/bitcoin.php old mode 100755 new mode 100644 diff --git a/examples/electrum.php b/examples/electrum.php old mode 100755 new mode 100644 diff --git a/examples/electrum_sign_multisig.php b/examples/electrum_sign_multisig.php old mode 100755 new mode 100644 diff --git a/examples/multisig.php b/examples/multisig.php old mode 100755 new mode 100644 diff --git a/examples/order_multisig.php b/examples/order_multisig.php old mode 100755 new mode 100644 diff --git a/examples/prompt_sign_multisig.php b/examples/prompt_sign_multisig.php old mode 100755 new mode 100644 diff --git a/examples/raw_transaction.php b/examples/raw_transaction.php old mode 100755 new mode 100644 diff --git a/examples/sign_p2sh.php b/examples/sign_p2sh.php old mode 100755 new mode 100644 diff --git a/examples/sign_p2sh_stepbystep.php b/examples/sign_p2sh_stepbystep.php old mode 100755 new mode 100644 diff --git a/examples/signature_verification.php b/examples/signature_verification.php old mode 100755 new mode 100644 diff --git a/examples/test_bip32.php b/examples/test_bip32.php old mode 100755 new mode 100644 diff --git a/phpunit.xml b/phpunit.xml old mode 100755 new mode 100644 diff --git a/src/BIP32.php b/src/BIP32.php old mode 100755 new mode 100644 diff --git a/src/BitcoinLib.php b/src/BitcoinLib.php old mode 100755 new mode 100644 diff --git a/src/Electrum.php b/src/Electrum.php old mode 100755 new mode 100644 diff --git a/src/Jsonrpcclient.php b/src/Jsonrpcclient.php old mode 100755 new mode 100644 diff --git a/src/RawTransaction.php b/src/RawTransaction.php old mode 100755 new mode 100644 diff --git a/tests/AgainstRPCTest.php b/tests/AgainstRPCTest.php old mode 100755 new mode 100644 diff --git a/tests/BIP32CoreTest.php b/tests/BIP32CoreTest.php old mode 100755 new mode 100644 diff --git a/tests/BIP32Test.php b/tests/BIP32Test.php old mode 100755 new mode 100644 diff --git a/tests/BitcoinLibTest.php b/tests/BitcoinLibTest.php old mode 100755 new mode 100644 diff --git a/tests/BitcoinLibTestNetTest.php b/tests/BitcoinLibTestNetTest.php old mode 100755 new mode 100644 diff --git a/tests/RawTransactionTest.php b/tests/RawTransactionTest.php old mode 100755 new mode 100644 diff --git a/tests/testElectrum.php b/tests/testElectrum.php old mode 100755 new mode 100644