Blockchain.info sendet möglicherweise Transaktionen API v2

Ich verwende derzeit v2 der API von Blockchain.info und möchte "Send Many Transaction" verwenden und habe einige Probleme.

Ich habe 1 Wallet mit vielen Adressen, ich versuche, 2 Transaktionen innerhalb einer Zahlung zu senden, ihre API-Dokumentation ist immer noch von v1 und es fehlt das „&from“ aus ihrem API-Beispiel, und ich habe mehr Zeit damit verbracht, als ich zugeben möchte damit das funktioniert.

das ist von dort webseite:

http://localhost:3000/merchant/$guid/sendmany?password=$main_password&second_password=$second_password&recipients=$recipients&fee=$fee

$main_password Your Main Blockchain wallet password
$second_password Your second Blockchain Wallet password if double encryption  is enabled.
$recipients Is a JSON Object using Bitcoin Addresses as keys and the amounts to send as values (See below).
$from Send from a specific Bitcoin Address (Optional)
$fee Transaction fee value in satoshi (Must be greater than default fee) (Optional)
$note A public note to include with the transaction -- can only be attached to transactions where all outputs are greater than 0.005 BTC.(Optional)

Das Ergebnis, das ich bekomme, ist:

Stream konnte nicht geöffnet werden:HTTP-Anfrage fehlgeschlagen!

Schwerwiegender Fehler: Maximale Ausführungszeit von 120 Sekunden überschritten

Ich habe jetzt die URL ist falsch, aber kann mir bitte jemand helfen, was es speziell ist.

Bisher habe ich das hier

// Sending addresses 
$Address1 = 'Address1';
$Address2 = 'Address2';

//Amount coming from
$From = 'Address3';

//Amounts being sent in satoshi
$Amount1 = 100000;  // 0.001 of a btc
$Amount2 = 100000;  

$recipients = urlencode(' {
    "'.$Address1.'": '.$Amount1.',  
    "'.$Address2.'": '.$Amount2.'
}');

$Guid = 'MY_GUID';      
$Password = 'MY_PASSWORD';                              

$url = 'http://localhost:3000/merchant/'.$Guid.'/sendmany?password='.$Password.'&from='.$From.'&recipients='.$recipients.''; 
// I've also tried to remove $data and put '&api_code=MY_API_CODE' after
// $recipients as this also works for other api calls for v2

$data = array('api_code' => 'MY_API_CODE');

$result = sendAmounts($url, $data);

function sendAmounts($url, $data) { 
$options = array(
    'http' => array(
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  => 'POST',  // Also tried GET
        'content' => http_build_query($data),
    ),
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

return $result;
}

Vielen Dank im Voraus.

Haben Sie Ihren lokalen nodejs-Dienst bereits eingerichtet?
@m1xolyd1an - ja, ich habe nodejs eingerichtet, ich kann Guthaben abrufen, eine einzelne Zahlung senden usw.. Nur viele Transaktionen zu senden, macht mir Kummer

Antworten (1)

Ab Januar 2016 hat Blockchain.info Änderungen am Wallet-API-Dienst vorgenommen, die nun erfordern, dass Sie einen lokalen NodeJS-Dienst ausführen, um die Aufrufe zu verarbeiten. Dies erfordert, dass Sie Root-Zugriff auf Ihren Webserver haben, sodass Sie einen VPS anstelle eines einfachen gemeinsam genutzten Webhosts verwenden müssen.

Ich empfehle auch nicht, den JSON bei der Verwendung von sendmany selbst von Hand zu codieren. Erstellen Sie stattdessen ein Array und verwenden Sie dann die Funktion json_encode.

$array = array(
    "1someAddress" => 20000,
    "1someAddress2" => 150000,
    "1someAddress3" => 314159
); 
$addresses = json_encode($array);

Sie sind nicht der Einzige, der mit der neuen Version ihrer API Schwierigkeiten hat. Wenn Sie noch Hilfe benötigen, sehen Sie sich diese Ressourcen an.

https://www.youtube.com/watch?v=X8jsaf4sEgs
http://btcthreads.com/how-to-setup-blockchain-wallet-service/

Ich habe eine PHP-Bibliothek für die Kommunikation mit dem nodeJS-Dienst gestartet (muss noch bearbeitet werden, einige Funktionen fehlen) https://github.com/coinables/blockchain-wallet-APIv2-PHP-Library