Message Bus for Bitcoin

Examples Explorer Github Slack


Before diving in, here are some useful links that may be helpful in your journey with Bitsocket:
  1. Bitquery
    Bitsocket is powered by bitquery, a bitcoin query language. Here's the documentation
  2. Twitter
    Follow @_unwriter on Twitter for bitsocket related announcements
  3. Github
    Bitsocket Github Repository. Bitsocket is 100% open sourced.
  4. Slack
    Have questions? Join the chat and meet other Bitsocket users and developers.


Bitsocket API is just Server Sent Events, no magic.
Copy and paste the code below and try running them. They are fully functional!

// Bitquery
var query = {
  "v": 3, "q": { "find": {} }
// Base64 encoded query
var b64 = btoa(JSON.stringify(query))
// Subscribe to EventSource
var bitsocket = new EventSource(''+b64)
// Handle new messages
bitsocket.onmessage = function(e) {
  document.write("<pre>" + JSON.stringify(JSON.parse(, null, 2) + "</pre>")

var EventSource = require('eventsource')
var query = {
  "v": 3, "q": { "find": {} }
var b64 = Buffer.from(JSON.stringify(query)).toString("base64")
var bitsocket = new EventSource(''+b64)
bitsocket.onmessage = function(e) {


As you saw above, there's not much to bitsocket, it's just a pure SSE (server sent events).

The only thing that you need to learn is Bitquery.

In Bitsocket world, you define events by declaring a query filter. When a transaction that matches that filter comes along, it will be push notified to your client.

However it's important to note that the Bitquery language used by Bitsocket is just a subset of the full query language. Here are the limitations:
  1. Only "q.find" filter supported
    Among the Bitquery syntax, only the q.find (for "find" query) is supported (No "aggregate", "limit", etc.)
  2. No full text search support
    Currently, full text search is not supported for bitsocket.
  3. Use Regular Expression filters
    On bitsocket, a regular expression filter is encouraged over full text search (This is the opposite for bitdb because of the way Bitdb indexes things
  4. Use "r.f" for processing
    You have full access to Bitquery's processing function. Use it to build your own custom APIs
With that said, let's go learn Bitquery!

Learn Bitquery