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 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-xdag

v1.0.1

Published

communicate with xdag (via unix_sock now)

Readme

node-xdag

node.js communicate with xdag (via unix_sock now)

Build Status

Usage


> npm install node-xdag --save

const XDag = require('node-xdag')
const xdag = new XDag({socketFile:'path/xdag/unix_sock.data'})

Options

socketFile

type: string

path of the xdag unix_sock.dat file

API

getBalance

get xdag balance

xdag.getBalance("xdagAddress")
    .then((data) => {
        console.log(data.result);// balance
    })
    .catch((err) => {
        console.error(err);//err
    })

getBlock

get the xdag block info

result

{
    "account":"4f1Sp/UD55JX5+kQCevUCpyenaPwqmpC",
    "balance":"1024",
    "difficulty":"0000000013147562c",
    "hash":"d6ad0e0cf7b099ff426aaaf0a39d9e9c0ad4eb0910e9e75792e703f5a752fde1",
    "file pos":"7e00",
    "flags":"1c",
    "timestamp":"16a2c094123",
    "time":"2018-02-20",
    "transaction":[
        { "direction": "fee",
        "address":"OwFhTJbCdaj1ZqkJYPxrGDjGSvXlGrv7",
        "amount": "0.000000000" }
        
    ],
    "address":[
        { 
            "direction": "input",
            "address": "81a9+kgFbquw6GGKju/VkS7KiUWmOOxy",
            "amount": "0.003222176",
            "time": "2018-02-20 04:58:40.815"
        }
        
    ]

}

example

xdag.getBlock('blockAddress')
    .then((data) => {
        console.log(data.result);//block info
    })
    .catch((err) => {
        console.error(err);
    })

getStats

get the xdag's stats

result

{ "hosts": "320 of 320",
  "blocks": "14311273 of 14311295",
  "main blocks": "102117 of 102117",
  "orphan blocks": "1",
  "wait sync blocks": "28",
  "chain difficulty": "1d79edf0ecb4d2c0e71859df10 of  1d79edf0ecb4d2c0e71859df10",
  "XDAG supply": "104567808.000000000 of 104567808.000000000",
  "4 hr hashrate MHs": "0.00 of 6397628.62"
}

example

xdag.getStats().then((data) => {
                console.log(data.result);
            }).catch((err) => {

            })

getLastBlocks

get xdag last N blocks

result

type: Arrary

[ "o5+zRJy7tVzzZ763+kQHIP5H4RLltZJv",
  "XsLYI0NJ0mnXWW6ocx3PzUoTk/4d45an",
  "0MnKSxiXJRPXs3HHBqzeQyqgU0Kv5/Ka",
  "2rrC3NR7uOT0VZSgXNlEtnB847PsOHnS",
  "GZ4R4mQLSKeBZwfeUizAi2kZ1jOAfTsV",
  "koqkXiy6a/RVUXdSCip7kKmmuSF+QkiO",
  "T4jj427IPx0h6JarVUxaRI+/X8tNdXNu",
  "2E1KfP8v6o4MVLb1Lkw/FaIBNAcJEZKO",
  "jM4Kx8AJ3BSP95lEoEC6x6uZ2/x+g3cE",
  "OJpD1d8P0IIKABo4evFDrjKa66/RDV1n" ]

example


            xdag.getLastBlocks(10)
                .then((data) => {
                    console.log(data.result);
                    done();
                })
                .catch((err) => {
                    console.error(err);
                    done(err);
                })

getMiners

params

minerStatus: String, optional, Default: null; status: 'active', 'archive', 'free'

result

{ "miners":
   [ 
       { "address": "XZomlEkBFTLWYEycxr86zOrDdopONt/r",
       "status": "active",
       "ip": "125.71.100.120",
       "port": "19415",
       "inBytes": "19232",
       "outBytes": "14752",
       "nopaidShares": "294.039915"
        }],
  "total": 1 
  }

example


            xdag.getMiners('active')
                .then((data) => {
                    console.log(data.result);
                })
                .catch((err) => {
                    console.error(err);
                })

Building

> git clone  [email protected]:feiin/node-xdag.git
> npm install

Testing

> npm test 

test with xdag

> npm run xdagtest

Maintainers

solar (xdag: 4f1Sp/UD55JX5+kQCevUCpyenaPwqmpC)