npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@owstack/ows-elastic-sync

v1.0.3

Published

An OWStack module to sync blockchain data to elasticsearch

Downloads

8

Readme

OWS Elastic Sync

NPM Package Build Status Coverage Status

Overview

This OWS middleware will synchronize data from a bitcoind-like system (Bitcoin, Bitcoin Cash, Litecoin, etc) to an elasticsearch cluster. This allows for distribution of queries across shards in the cluster for higher performance than can be achieved by querying a single or multiple bitcoind-like systems directly via RPC.

This middleware copies data into elasticsearch. It does not provide a query API itself. Elasticsearch can be queried directly using it's powerful API. There may be other middlewares that are developed to provide APIs for common queries.

Getting started

You can build your node using an existing OWS Node's Docker image as a base. Here is a Dockerfile to build this project for Bitcoin Cash (BCH) based on the owstack/bch-node image, built from this docker file.

FROM owstack/btc-node
USER ows
WORKDIR $APP_DIR
RUN $PKG_NAME install @owstack/ows-elastic-sync
CMD ["bchnode", "start"]

This node will also need a config file, that allows it to connect to at least 1 bitcoind-like service, and elasticsearch. Here is an example bch-node.json:

{
  "network": "livenet",
  "port": 3001,
  "services": [
    "bitcoin-cash-sync",
    "bitcoind",
    "web"
  ],
  "servicesConfig": {
      "bitcoind": {
        "connect": [{
          "zmqpubrawtx": "tcp://localhost:28339",
          "zmqpubhashblock": "tcp://localhost:28339",
          "rpcprotocol": "http",
          "rpchost": "localhost",
          "rpcport": 8339,
          "rpcuser": "someusername",
          "rpcpassword": "somepassword"
        }]
      },
      "bitcoin-cash-sync": {
          "module": "@owstack/ows-elastic-sync",
          "config": {
              "concurrentRPC": 150,
              "currency": "BCH",
              "es": {
                  "host": "localhost:9200",
                  "log": "error"
              }
          }
      }
  }
}

Lastly, an easy way to orchestrate Docker containers is with Docker Compose. A working docker-compose.yml that mounts /data from the host, might look like this (although it is not advisable to run all of this on one machine, it is possible):

version: '2'
services:
    es:
        image: docker.elastic.co/elasticsearch/elasticsearch:5.3.3
        environment:
          - cluster.name=docker-cluster
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms4096m -Xmx4096m"
          - xpack.security.enabled=false
        ulimits:
          memlock:
            soft: -1
            hard: -1
          nofile:
            soft: 65536
            hard: 65536
        mem_limit: 16g
        cap_add:
          - IPC_LOCK
        ports:
            - 9200:9200
        volumes:
            - /data/es:/usr/share/elasticsearch/data
    bitcoin-abc:
        image: "owstack/bitcoin-abc:0.16.0-ows"
        user: root
        command: "/usr/local/bin/bitcoind -datadir=/data -printtoconsole"
        ports:
          - "8339:8332"
          - "28339:28332"
        volumes:
          - /data/bitcoin-abc:/data
    bch-node:
      image: 1234567890 #whatever your image is
      ports:
        - "3009:3001"
      depends_on:
        - "bitcoin-abc"
      volumes:
        - /data/bch-node:/home/ows/config
      command: "bchnode start -c /home/ows/config -m /home/ows/bitcoin-cash-services"

You will also need a working bitcoin.conf file in your /data/bitcoin-abc directory on the host.