Overview sqlChain is a compact SQL layer that runs on top of bitcoind. It extends the query options on the blockchain with a priority towards lower storage demands. This demonstration server provides multiple API (compatible) interfaces:
  • Insight API (with some extensions)
  • Blockchain.info API (with WebSocket)
  • RPC via POST, GET urls
  • Electrum server
The Demo API page above documents the queries supported and differences to the original sites.

Three daemon programs are provided:
  • sqlchaind updates the mysql backend from bitcoind.
  • sqlchain-api provides an the API and web interfaces for querying the database.
  • sqlchain-electrum adds a layer over sqlchain-api supporting Electrum clients.
Using sqlChain over a pruning node as a compact alternative, a web socket interface, and other ideas, are currently under development. Status and blockchain analysis information below is updated periodically from this server. The open source Python code is available in the neoCogent Github and please check out my neoCogent blog. Server StatusThis information is provided by the /api/status/db/html call.
Insight
  • /api/block/0000000000001271efd5d9f7e539909160a181b2c0a2b8c164d6f8159e5c7dd9
  • /api/block-index/123432
  • /api/tx/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56
  • /api/raw/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56
  • /api/addr/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH?noTxList=1
  • Spelling mistake on txApperances is maintained for compatibility.
  • /api/addr/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH/balance
  • /api/addr/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH/totalReceived
  • /api/addr/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH/totalSent
  • /api/addr/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH/unconfirmedBalance
  • /api/addr/1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR/utxo
  • /api/addrs/1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR,1CmTtsKEqPxZsW3YjGYXbPSY89xrzkhy94/utxo
  • Also supports POST at '/api/addrs/utxo' with param 'addrs'.
  • /api/addrs/17pfg6L3hT1ZPBASPt7DCQZfy9jWeMGq1W,1CmTtsKEqPxZsW3YjGYXbPSY89xrzkhy94/txs?from=0&to=1
  • Also supports POST at '/api/addrs/txs' with params 'addrs,from,to'.
  • /api/txs?block=0000000000001271efd5d9f7e539909160a181b2c0a2b8c164d6f8159e5c7dd9
  • /api/txs?address=1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH
  • /api/utils/estimatefee?nbBlocks=2
  • /api/tx/send
  • Send raw transaction by POST method with param 'rawtx'.
Blockchain.info
  • /bci/block-height/123432
  • ...
  • /bci/rawblock/0000000000001271efd5d9f7e539909160a181b2c0a2b8c164d6f8159e5c7dd9
  • /bci/rawtx/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56?format=hex
  • /bci/address/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH
  • /bci/unspent/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH
  • /bci/latestblock
  • /bci/q/getblockcount
  • ws://api-host/ws
  • Blockchain.info compatible websocket interface
RPC This api also available via POST with [method,params] args.
  • /rpc/getinfo
  • /rpc/getdifficulty
  • /rpc/getblock/0000000000001271efd5d9f7e539909160a181b2c0a2b8c164d6f8159e5c7dd9
  • /rpc/getblockhash/123432
  • /rpc/getblockcount
  • /rpc/getrawtransaction/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56
  • /rpc/gettxout/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56/1
  • /rpc/getmempoolinfo
  • /rpc/getrawmempool
Electrum Extensions to support sqlchain-electrum server.
  • /api/history/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH
  • /api/history/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH/status
  • /api/history/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH/balance
  • /api/history/1JK6pUCAXfnvcbXEpdVSxhVZ8W6kxQ4VEH/uncfmd
  • /api/history/1FvzCLoTPGANNjWoUo6jUGuAG3wg1w4YjR/utxo
  • /api/block-index/167324/electrum
  • /api/tx/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56/output/1
  • /api/tx/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56/raw
  • /api/tx/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56/addrs
  • /api/merkle/2acba2c6916cdfdbf3584dfdd32534af5031ab076029ff275167fa5181dee0a8
Extras Extensions, and status / debugging.
  • /api/auto/123432
  • Auto detect value and return appropriate data.
    Supports 4 modes: block-index, block hash, address, tx hash.
    Also available as POST method with 'data' parameter, as demonstrated above with "Find".
  • /api/closure/1M8s2S5bgAzSSzVTeL7zruvMPLvzSkEAuv
  • Compute the closure of an address. That is, the addresses likely to be owned by the same entity.
  • /api/status
  • /api/status/db/html
  • Returns database information like row counts, disk space used.
    Advanced info like multi-sig address count, id collision counts, non-std and unspent output counts are updated periodically due to slow query time. An html version returns a table that can be used in web pages with styling.
  • /api/tx/23bb66ef300714042085d0ed2d05100531e80d5239020545887df059c0178b56/html
  • An html table formatted version of raw transaction data with hex values and op codes.
Roll Your Own Blockchain Web App It's easy to create a web app based using sqlChain on an Ubuntu server.

See the full install guide on github, but briefly:
  1. Install base packages:
    # may not need but won't hurt
    sudo apt-get install python-software-properties libev-dev libevent-dev
  2. sudo apt-get install bitcoind mysql-server libmysqlclient-dev python-pip python-dev
  3. Install sqlchain from PyPi:
    sudo pip install sqlchain
  4. Run the init script to setup mysql db, users and config files:
    sudo sqlchain-init
  5. Start the daemons, as needed:
    sudo start bitcoin
    sudo start sqlchain
    sudo start sqlchain-api
  6. Modify the /var/www source files as your own app.
  7. Scale to serve the world:
    run nginx as front end and mysql replication behind.
Support Huh, What support?

More seriously, I put a lot of work into creating this. If you want to support continued effort by donating that would be cool. Visit my blog donation page.

I do freelance programming work, and I'm available to build on this commericially for you or work on other Bitcoin related projects. My rates are very reasonable, given my expertise, because I live in a downright life-is-cheap country. So if donating rubs you the wrong way then you can always hire me.