Blockchain Wallet API: Bitcoin Wallet API

Blockchain Wallet API Elementary API for Blockchain Wallet users to send and receive bitcoin payments.

The Blockchain Wallet API provides a ordinary interface Merchants can use to programmatically interact with their wallet.

Installation

To use this API, you will need to run petite local service which be responsible for managing your Blockchain Wallet. Your application interacts with this service locally via HTTP API calls. Click here for accomplish setup instructions on GitHub.

Create Wallet API Create blockchain wallets programmatically

The create_wallet method can be used to create a fresh blockchain.info bitcoin wallet.

URL: http://localhost:3000/api/v2/create Method: POST or GET

  • $password The password for the fresh wallet. Must be at least ten characters in length.
  • $api_code An API code with create wallets permission.
  • $priv A private key to add to the wallet (Wallet import format preferred). (Optional)
  • $label A label to set for the very first address in the wallet. Alphanumeric only. (Optional)
  • $email An email to associate with the fresh wallet i.e. the email address of the user you are creating this wallet on behalf of. (Optional)

Please create an API code here including permissions to “Create Wallets”.

Response: 200 OK, application/json

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 one hundred million to get the amount in BTC. The Base URL for all requests: https://blockchain.info/ru/merchant/$guid/. $guid should be substituted with your Blockchain Wallet identifier (found on the login page).

  • $main_password Your Main Blockchain Wallet password
  • $second_password Your 2nd Blockchain Wallet password if dual 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)
Response: 200 OK, application/json

Send Many Transactions

Send a transaction to numerous recipients in the same transaction.

  • $main_password Your Main Blockchain wallet password
  • $second_password Your 2nd Blockchain Wallet password if dual 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)
Response: 200 OK, application/json

The above example would send one BTC to 1JzSZFs2DQke2B3S4pBxaNaMzzVZaG4Cqh, fifteen BTC to 12Cf6nCcRtKERh9cQm3Z29c9MWvQuFSxvT and two BTC to 1dice6YgEVBf88erBFra9BHf6ZMoyvG88 in the same transaction.

Response: 200 OK, application/json

PHP Example

Fetching the wallet balance

Fetch the balance of a wallet. This should be used as an estimate only and will include unconfirmed transactions and possibly dual spends.

Response: 200 OK, application/json

Listing Addresses

List all active addresses in a wallet. Also includes a zero confirmation balance which should be used as an estimate only and will include unconfirmed transactions and possibly dual spends.

Response: 200 OK, application/json

Getting the balance of an address

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

  • $main_password Your Main Blockchain wallet password
  • $address The bitcoin address to lookup
Response: 200 OK, application/json

Generating a fresh address

  • $main_password Your Main Blockchain wallet password
  • $second_password Your 2nd Blockchain Wallet password if dual encryption is enabled.
  • $label An optional label to link to this address. It is recommended this is a human readable string e.g. “Order No : 1234”. You May use this as a reference to check balance of an order (documented later)
Response: 200 OK, application/json

Address Management

Archiving an address

To improve wallet spectacle addresses which have not been used recently should be moved to an archived state. They will still be held in the wallet but will no longer be included in the “list” or “list-transactions” calls.

For example if an invoice is generated for a user once that invoice is paid the address should be archived.

Or if a unique bitcoin address is generated for each user, users who have not logged in recently (

30 days) their addresses should be archived.

  • $main_password Your Main Blockchain wallet password
  • $address The bitcoin address to archive
Response: 200 OK, application/json

Unarchive an address

Unarchive an address. Will also restore consolidated addresses (see below).

  • $main_password Your Main Blockchain wallet password
  • $address The bitcoin address to unarchive

Related video:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *