2013-04-24 114 views
4

如何使用比特幣地址發送和接收交易。
我正在使用this url
我只有發送和接收比特幣地址。
另外我沒有我的電子錢包帳戶。

我已經使用了下面的代碼。
發送和接收比特幣交易

$to = // Bitcoin address1 
$from = // Bitcoin address2 
$json_url = "https://blockchain.info/merchant/d15dea6639d24b81e5caefad8aa4b0c6831cdccf1c21f8c234fd568d40e4238d/payment?to=$to&amount=5000&from=$from"; 


我得到了下面的錯誤。

"You must provide a recipient address" 

謝謝大家。

+0

我認爲你需要在API調用中使用密碼。 – 2013-05-30 16:07:04

+1

注意依靠https安全性,因爲它已被nsa破解。 http://www.theguardian.com/world/2013/sep/05/nsa-gchq-encryption-code-security – mulllhausen 2013-09-13 06:17:16

回答

1

只需填寫以下信息...您需要一個BlockChain賬戶才能發送付款。但是,您不需要帳戶即可接收。這只是發送,而不是回調。如果你正在尋找一個回調文件進一步閱讀。

https://blockchain.info/merchant/ $ GUID /支付?密碼= $ main_password & second_password = $ second_password &到= $地址&金額= $金額&從= $從&共享= $共享&費= $fee¬e= $注意

<?php 

$guid="GUID_HERE"; 
$firstpassword="PASSWORD_HERE"; 
$secondpassword="PASSWORD_HERE"; 
$amounta = "10000000"; 
$amountb = "400000"; 
$addressa = "1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq"; 
$addressb = "1ExD2je6UNxL5oSu6iPUhn9Ta7UrN8bjBy"; 
$recipients = urlencode('{ 
       "'.$addressa.'": '.$amounta.', 
       "'.$addressb.'": '.$amountb.' 
      }'); 

$json_url = "http://blockchain.info/merchant/$guid/sendmany?password=$firstpassword&second_password=$secondpassword&recipients=$recipients"; 

$json_data = file_get_contents($json_url); 

$json_feed = json_decode($json_data); 

$message = $json_feed->message; 
$txid = $json_feed->tx_hash; 

?> 
+0

我喜歡這個簡單但應該指出,應該是https而不是http,因爲它暴露了pws。 – sradforth 2013-09-06 10:24:48

0

您需要在blockchain.info錢包,以發送/接收使用「我的錢包API」基金:https://blockchain.info/api/blockchain_wallet_api

如果你要使用這個API我有我使用的PHP類一世與我的區塊鏈錢包互動:https://github.com/lukesims/Blockchain-API-PHP-Class您可能會覺得它很有用。

如果您只想接收付款,則使用不同的「接收付款API」。我不能發佈超過2個鏈接,但區塊鏈開發人員部分對這兩者進行了明顯的區分。