自动将钱包余额发送到另一个钱包

Automatically Send Wallet Balance to Another Wallet

我想使用区块链钱包 API : https://blockchain.info/api/blockchain_wallet_api 自动将所有比特币发送到特定地址。

就像地址 1 收到存款一样,它应该自动转移到地址 2。 知道它将如何工作吗?

不知道大家是否还对这个问题感兴趣,不过我还是会回答的。

您可以编写一个简单的程序,每秒/分钟/小时检查一个地址的余额,如果余额 > 0,您将余额从该特定地址发送到您的目标地址。

来自您发布的link:

Getting the balance of an address

Retrieve the balance of a bitcoin address. Querying the balance of an address by label is depreciated.

http://localhost:3000/merchant/$guid/address_balance?password=$main_password&address=$address&confirmations=$confirmations

$main_password Your Main Blockchain wallet password
$address The bitcoin address to lookup
$confirmations Minimum number of confirmations required. 0 for unconfirmed.

这是您在您选择的时间间隔内调用的方法。您将得到 JSON 格式的答案:

{"balance" : 50000000, "address" : "19r7jAbPDtfTKQ9VJpvDzFFxCjUJFKesVZ", "total_received" : 100000000}

如果balance > 0,你调用这个方法:

Making Outgoing Payments

Send bitcoin from your wallet to another bitcoin address. All transactions include a 0.0001 BTC miners fee.

All bitcoin values are in Satoshi i.e. divide by 100000000 to get the amount in BTC. The Base URL for all requests: https://blockchain.info/merchant/$guid/. $guid should be replaced with your Blockchain Wallet identifier (found on the login page).

http://localhost:3000/merchant/$guid/payment?password=$main_password&second_password=$second_password&to=$address&amount=$amount&from=$from&fee=$fee&note=$note

  • $main_password Your Main Blockchain Wallet password

  • $second_password Your second Blockchain Wallet password if double encryption is enabled.

  • $to Recipient Bitcoin Address.
  • $amount Amount to send in satoshi.
  • $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 when outputs are greater than 0.005 BTC. (Optional)

您也可以查看多个地址是否有余额,然后将其发送到您的目标地址。