2016-11-04 5 views
1

blockcypher를 사용하여 생성 한 비트 코인 주소가 있습니다.이 비트 코인을 이미 다른 주소로 전송하고 싶습니다. 내가 샘플 코드 https://www.blockcypher.com/dev/bitcoin/?php#creating-transactionshttps://github.com/blockcypher/php-client/blob/master/sample/transaction-api/CreateTransaction.php를 사용하여 트랜잭션을 생성 할 blockcypher PHP 클라이언트를 사용하고blockcypher api를 사용하여 bitcoin 트랜잭션을 생성 할 수 없습니다.

, 나는 내가 파일을 공급 업체를 확인하고 Mdanter \ ECC에서 GMP 파일이나 클래스가

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

오류를 얻을 \ Math \ Gmp, 그래서 math.php 파일을 편집하고 6 행을 편집하여 \ Mdanter \ Ecc \ Math \ GmpMath를 Gmp로 사용했습니다. 지금 https://github.com/blockcypher/php-client/issues/21

내 코드에서 하나 같이 오류가

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 "by mdanter/ecc": "0.3. *" – josecelano

+0

@ josecelano 어떤 버전의 sdk를 사용하고 있습니까? – Erick

답변

1

문제는 PHP 클라이언트 종속성 중 하나에 나쁜 종속 구성에 의해 발생 된 다음과 같습니다. 그것은 고쳤다. 더 많은 정보 :

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

당신은 최신 버전으로 PHP 클라이언트를 업데이트해야합니다.