0

I want to use Blockchain Wallet API : https://blockchain.info/api/blockchain_wallet_api to send all the bitcoins to a particular address automatically.

Like if address1 gets a deposit, it should automatically move to address2. Any idea how will it work?

1 Answer 1

2

I don't know if you are still interested in this question but I will answer anyway.

You can write a simple program that checks the balance on an adress every second / minute / hour and, if the balance is > 0, you send the balance from that particular adress to your target adress.

From the link you posted:

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.

This is the method you call in an interval of your choice. You will get an answer in JSON-Format:

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

If balance > 0, you call this method:

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)

You can also check multiple adresses for positive balance and send it to your target adress.