1.0.0 • Published 2 years ago

bap-junglebus v1.0.0

Weekly downloads
-
License
Open BSV License
Repository
github
Last release
2 years ago

bap-junglebus

BAP transaction indexer for JungleBus

BAP-junglebus is a JungleBus compatible Bitcoin Attestation Protocol indexer. It scans all BAP transactions and processes them into a global BAP state using GorillaPool's JungleBus.

global installation

npm install -g bap-junglebus

Set the environment variables. You must at least set a JungleBus subscription.

export BAP_SUBSCRIPTION_ID=""

And optionally overwrite the defaults for the database:

export BAP_MONGO_URL="mongodb://localhost:27017/bap"

Indexing BAP blocks can now be done by running

bap-junglebus

The arguments to the bap-junglebus cli are:

argDescription
-s <subscription id>JungleBus subscription ID

local installation

git clone https://github.com/icellan/bap-junglebus.git

BAP-junglebus can run either with settings from a config file (config.json) or from environment variables.

config.json

{
  "subscriptionId": "...",
  "mongoUrl": "mongodb://..."
}

environment

export BAP_SUBSCRIPTION_ID="..."
export BAP_MONGO_URL="mongo://..."

run

To run the indexer:

./start.sh

testing

yarn test

or

yarn testwatch

Including in your own package or site

npm install bap-junglebus
or
yarn add bap-junglebus

Make sure you set the environment variables before running any scripts:

export BAP_SUBSCRIPTION_ID = '<junglebus subscription id>';
export BAP_MONGO_URL = 'mongodb://localhost:27017/bap';

Index all BAP transactions (also from mempool):

import { watchBAPTransactions } from 'bap-junglebus/src/bap';

(async function() {
  await watchBAPTransactions();
})();

Babel

Make sure babel is set up properly or that es6 is supported by your own package.