node package manager



Request information about the state of Open Publish documents and ownership.


This module is a client-side library for performing queries on Open Published documents.

A user in the context of Open Publish is a Bitcoin wallet address such as the tesnet address mqMsBiNtGJdwdhKr12TqyRNE7RTvEeAkaR.


npm install openpublish-state


The openpublish-state module defaults to using the Open Publish state engines that run at and

First we need to create the client and specify which blockchain network we're interested in querying.

var openpublishState = require('openpublish-state')({
  network: "testnet" // "bitcoin" 

Finding a single document by SHA1

openpublishState.findDoc({sha1: "f072bf66cd807c48e37170137b6f8bd3dc01963e"}, function(err, openpublishDoc) {
  // openpublishDoc looks like the following: 

Find all documents by type

openpublishState.findAllByType({type: "image", limit: 10}, function(err, openpublishImageDocs) {
  // returns the 10 latest images that have been published 

Find all documents published by a user

openpublishState.findDocsByUser({address: "mqMsBiNtGJdwdhKr12TqyRNE7RTvEeAkaR"}, function(err, openpublishDocs) {
  // returns all docs published by mqMsBiNtGJdwdhKr12TqyRNE7RTvEeAkaR 

Find tips

openpublishState.findTips({sha1: "f072bf66cd807c48e37170137b6f8bd3dc01963e"}, function(err, tipInfo) {
  // tipInfo looks like: 
    tips: [{
      "opendoc_sha1": "f072bf66cd807c48e37170137b6f8bd3dc01963e",
      "destination": "{\"mqMsBiNtGJdwdhKr12TqyRNE7RTvEeAkaR\"}",
      "amount": 10000,
      "created_at": "2015-08-17T20:40:30.457Z",
      "updated_at": "2015-08-17T20:40:30.456Z",
      "output": {
        "tx_hash": "398244834976e88870e364935189d0d92031d22543338d46f8141af22bf36ab8",
        "position": 1,
        "height": 531011,
        "branch": "main"
      "sourceAddresses": [
    }, ...],
    totalTipAmount: 20000,
    tipCount: 2