2016-11-04 6 views
1

私はblockcypherを使用して作成したビットコインアドレスを持っていますが、そこから(すでにデポジットされた)ビットコインを別のアドレスに転送したいと思います。blockcypher APIを使用してbitcoinトランザクションを作成できません

私はサンプルコードhttps://www.blockcypher.com/dev/bitcoin/?php#creating-transactionshttps://github.com/blockcypher/php-client/blob/master/sample/transaction-api/CreateTransaction.phpを使用してトランザクションを作成するために、blockcypher PHPクライアントを使用しています、私はエラー

Class 'Mdanter\Ecc\Math\Gmp' not found in C:\xampp\htdocs\cck\vendor\bitwasp\bitcoin\src\Math\Math.php on line 8 

を取得する私は、ファイルにベンダーをチェックしMdanter \ ECCでGMPファイルまたはクラスがあります\ Math \ Gmp、私はmath.phpファイルを編集し、Gmpとして\ Mdanter \ Ecc \ Math \ GmpMathを使うように6行目を編集した。そして今https://github.com/blockcypher/php-client/issues/21

私のコード内の1つのようなエラーを取得するには、

require_once __DIR__.'/vendor/autoload.php'; 

use BlockCypher\Auth\SimpleTokenCredential; 
use BlockCypher\Rest\ApiContext; 
use BlockCypher\Api\TX as DD; 
use BlockCypher\Client\TXClient; 

// ... other classes 

$apiContext = ApiContext::create(
'main', 'btc', 'v1', 
new SimpleTokenCredential('4e3a287e603f48c994d978dab061084a'), 
array('log.LogEnabled' => true, 'log.FileName' => 'BlockCypher.log',  'log.LogLevel' => 'DEBUG')); 


$tx = new DD(); 

// Tx inputs 
$input = new \BlockCypher\Api\TXInput(); 
$input->addAddress("1DZR2kUCa5HTyVZLY8TWFf2ZfjhWgsgNtf"); 
$tx->addInput($input); 
// Tx outputs 
$output = new \BlockCypher\Api\TXOutput(); 
$output->addAddress("1Mye4sZmd9rzjY6yUw19etZhzeVU2q1kcj"); 
$output->setValue(1000); // Satoshis 
$tx->addOutput($output); 
// Tx amount 



$txClient = new TXClient($apiContext); 

$txSkeleton = $txClient->create($tx); 

$privateKeys =  array("3ed07ff3e458fabb8b99b723002f4817eebd5fc11f9c76fdd9c200090c04fd1c"); 

$txSkeleton = $txClient->sign($txSkeleton, $privateKeys); 

$txSkeleton = $txClient->send($txSkeleton); 
+1

"mdanter/ecc"のライブラリのバージョンを教えてください。 "bitwasp/bitcoi"ライブラリはこの依存関係mdanter/ecc "を使用している可能性があります:"〜0.3 "、mdanter/eccの最新バージョンには" Mdanter \ Ecc \ Math \ Gmp "クラスがありません。私たちはhttps://github.com/Bit-Wasp/bitcoin-phpで問題を開き、mdanter/ecc ":"〜0.3 "をmdanter/ecc": "0.3。*"に置き換えてください。 – josecelano

+0

@ josecelanoどのバージョンのsdkを使用していますか? – Erick

答えて

1

問題は、PHPクライアント依存関係の1つに悪い依存関係の設定によって引き起こされた、以下の通りです。それは修正されました。さらに詳しい情報:

https://github.com/blockcypher/php-client/issues/21

あなただけの最新リリースへのphp-クライアントをアップデートする必要があります。

関連する問題