Introduction SoChain's fast blockchain API is the easiest, most cost-effective way to build applications on Bitcoin, Litecoin, Dogecoin, Zcash, and Dash. We also offer Test Networks for developers to get started in a sandbox environment. Currency is just the first application of the Blockchain, and there's alot more to come. We're helping you make the future happen. This API is fast, and free. If you'd like to see more features, or if you need an obscenely large number of API calls, talk to us. We're happy to help. To get started, check out our basic code examples. Using this API is simple: no login or API key required. How quickly can you get started? Here's a Javascript example to get basic network information for the Dogecoin Blockchain: $.get( "https://sochain.com/api/v2/get_info/DOGE", function( response ) { // success! use the data any way you like }); We aim for the highest reliability in our systems. The following stats show our API's performance over the last 31 days. These stats were collected by a third party.

Note: The above statistics are for our public-facing infrastructure. Our private infrastructure has a guaranteed uptime of 99.99%. You can read more about it in the Rate Limits Section.

Rate Limits

The public infrastructure for SoChain allows 300 requests/minute free-of-charge. Additional tiers are coming soon.

Change Log

June 16, 2018

Auto convert Litecoin P2SH addresses to legacy P2SH version.

May 26, 2018

Added Zcash mainnet (ZEC) and testnet (ZECTEST).

March 18, 2017

Added Dash mainnet (DASH) and testnet (DASHTEST).

July 11, 2015

Confidence rating now considers double spend volume. Ratio of double spends to total transactions determines the maximum confidence achievable by a transaction.

June 20, 2015

The default network is Bitcoin (BTC), instead of Dogecoin (DOGE).

December 13, 2014

Confidence rating now changes to 0.0 if a double spend is detected. Also added field is_double_spend to the response of the get_confidence API call.

December 11, 2014

Added Network Confidence rating for unconfirmed transactions.

September 14, 2014

Bugfix in get_address_balance. Now correctly returns balance for given number of confirmations. Go to the API.

July 18, 2014

Added realtime balance updates to Pusher/websockets. Go to the API.

Added dynamic balance updates to address pages. Check it out by donating at the DevFund page.

June 14, 2014

Bug fix: Get Unspent Tx now correctly discards transactions that having been spent even if the spending transaction has not been confirmed.

June 12, 2014

Bitcoin main net (BTC) added to Explorer, and API.

Added support for CORS (Cross-Origin Resource Sharing).

Added time (UNIX time) field to Get Received Tx, Get Spent Tx, and Get Unspent Tx.

June 4, 2014

Added version, and locktime to Get Transaction.

June 1, 2014

Removed SAME-ORIGIN restriction from REST API. You can now use the JSON dataType with Javascript. You no longer need to use JSONP for Javascript accesses, although we will keep supporting it.

Added Javascript, Ruby/Ruby on Rails, and Python examples to get you started. See them here.

May 31, 2014

Added Litecoin main network to the Blockchain Explorer.

Enabled pagination for get_unspent_tx, get_received_tx, and get_spent_tx. The APIs are now limited to 100 transactions per call, and you can retrieve transactions that occurred specifically after a certain transaction ID. The script field in these API calls is now called script_asm, and we have added script_hex alongside the ASM as well. API calls affected are: Get Unspent Tx, Get Received Tx, and Get Spent Tx. These API calls now return a maximum of 100 unconfirmed transactions as well.

Minor change: price API (Realtime and REST) asked for an optional 'base_currency' parameter, but it read 'base_pair.' This is fixed. See the changes in the appropriate API.

Minor change: added network hash rate to Get Info.

May 28, 2014

In-depth API documentation and new, granular API calls to save you bandwidth and time. Javascript (JS), Ruby, and Python examples coming soon!

Added support for Litecoin main network, Bitcoin test network to the API.

Networks Supported

SoChain supports the Dogecoin, Bitcoin, Zcash, Dash, and Litecoin Blockchains, including the relevant Test Networks for experimentation. The API below requires you to specify the NETWORK when use the API. The NETWORK acronyms are as follows:

Blockchain (Network) Acronym Info Bitcoin BTC The main Bitcoin network. Currency has value. Dash DASH The main Dash network. Currency has value. Zcash ZEC The main Zcash network. Currency has value. Dogecoin DOGE The main Dogecoin network. Currency has value. Litecoin LTC The main Litecoin network. Currency has value. Bitcoin (Test Net) BTCTEST The Bitcoin test network. Currency has no value. Dash (Test Net) DASHTEST The Dash test network. Currency has no value. Zcash (Test Net) ZECTEST The Zcash test network. Currency has no value. Dogecoin (Test Net) DOGETEST The Dogecoin test network. Currency has no value. Litecoin (Test Net) LTCTEST The Litecoin test network. Currency has no value.

Code Examples

Accessing the SoChain API is simple. Whichever programming language you use, you can call our REST API using any HTTP adapter. Below are some basic examples of how to access our API through Javascript, Ruby/Ruby on Rails, and Python.

In the examples below, we get the name, and number of blocks on the Dogecoin network (DOGE). For more networks, see Networks Supported.

Using Javascript

Pre-requisites

For accessing this API using Javascript, we recommend using jQuery . Here is a simple call to get network information for Dogecoin:

In the example code, we will use jQuery to access the API.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

Example Code

The following code is an HTML example of the Javascript code. It requires inclusion of the jQuery javascript, as shown above.

// get network info for Dogecoin, and display network name and total number of blocks <script> $.get( "https://sochain.com/api/v2/get_info/DOGE", function( response ) { $( "body" ) .append( "Name: " + response.data.name + "<br/>" ) // Dogecoin .append( "Total Blocks: " + response.data.blocks + "</br>"); // current block count }, "json" ); </script>

Using Ruby

For accessing this API using Ruby or Ruby on Rails, we recommend using the HTTPClient gem. Furthermore, you will need the JSON gem to properly interpret the JSON response from our API.

Pre-requisites

In the example code, we use HTTPClient and JSON gems. Here's how to install them if using Ruby:

$ gem install httpclient

$ gem install json

If you are using Ruby on Rails instead, add the following lines to your Rails project's Gemfile in the root of your Rails project's directory.

gem 'httpclient' gem 'json'

Next, execute the following on the command-line in project's root directory, and you're all set for Ruby on Rails.

$ bundle install

Example Code

in the same directory.

Here is an example script to retrieve basic network information for Dogecoin:

require 'httpclient' require 'json' client = HTTPClient.new response = client.get('https://sochain.com/api/v2/get_info/DOGE') if response.status_code == 200 then # everything went swimmingly content = JSON.parse response.content puts "Name: "+content['data']['name'] puts "Total Blocks: "+content['data']['blocks'].to_s end

Using Python

For accessing the API through Python, we recommend the python-requests package.

Pre-requisites

Install the python-requests package by executing the following code on your command prompt.

$ pip install requests

If you prefer using apt-get instead to install Python packages, exceute the following code on your command prompt.

$ apt-get install python-requests

Example Code

import requests response = requests.get('https://sochain.com/api/v2/get_info/DOGE') if response.status_code == 200: # everything went swimmingly # parse the response as JSON content = response.json() print "Name:", content['data']['name'] print "Total Blocks:", content['data']['blocks']

Get Balance

Returns basic balance details for a Dogecoin, Bitcoin, or Litecoin address.

ENDPOINT

GET /api/v2/get_address_balance/{NETWORK}/{ADDRESS}[/{MINIMUM CONFIRMATIONS}]

PARAMETERS network: string

The acronym of the network you're querying. Required. address: string

The address on the network you're querying. Required. minimum confirmations: integer

The minimum confirmations for the balance. Optional. Default is 0. REQUEST

No request body required.

200 - SUCCESSFUL RESPONSE

A JSON object which contains the following fields:

network: string

The acronym of the network. address: string

The hash of the address. confirmed balance: string

The confirmed balance of the address as a string. unconfirmed balance: string

The unconfirmed balance of the address as a string. Balance remains unconfirmed until it is confirmed by the network.

404 - FAILED RESPONSE

The ADDRESS is not part of the NETWORK's blockchain, the NETWORK is unsupported, or MINIMUM CONFIRMATIONS is invalid.

{ "status": "fail", "data": { "network": "Network is required (DOGE, DOGETEST, ...)", "address": "A valid address is required", "confirmations": "Minimum number of confirmations (optional)" } }

EXAMPLE REQUESTS