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

dashgov

v1.0.0

Published

Utility functions for Dash governance on the blockchain.

Readme

DashGov.js

Utility functions for Dash governance on the blockchain.

Prosposal

  • proposal close (previous end epoch)
  • vote close
  • superblock (payment)
  • proposal open (start epoch)
  • vote open
  • proposal close (upcoming end epoch)
let current = {
  height: 2114623,
  ms: new Date("2024-08-01 22:01:00").valueOf(),
};
let cycles = 3;
let estimates = DashGov.estimateFutureBlocks(current, cycles);

let proposalObj = {
  start_epoch: current.proposalOpen[0].seconds,
  end_epoch: current.proposalClose[2].seconds,
  name: "test-proposal-4",
  payment_address: "yM7M4YJFv58hgea9FUxLtjKBpKXCsjxWNX",
  payment_amount: 100,
  type: 1,
  url: "https://www.dashcentral.org/p/test-proposal-4",
};

let proposalJson = JSON.stringify(proposal);
let encoder = new TextEncoder();
let proposalBytes = encoder.encode(proposalJson);

// JSON *should* be serialized canonically with lexicographically-sorted keys,
// HOWEVER, a hex string (not bytes) is used to guarantee reproducible output.
let proposalHex = Gobj.utils.bytesToHex(proposalBytes);

let now = Date.now();
let secs = now / 1000;
secs = Math.round(secs);

// Note: the full object is shown for completeness, however, most
//       gobject args were either deprecated or never implemented
let gobj = {
  // hashParent: null,
  // revision: 1, // MUST be one
  time: secs,
  dataHex: proposalHex,
  // signature: null,
};

gobj = DashGov.normalize(gobj);

let gobjBytes = DashGov.serializeForCollateralTx(gobj);
let gobjOpReturn = await DashGov.utils.doubleSha256(gobjBytes);

let keyUtils = {
  getPrivateKey: function (info) {
    // lookup by info.address or similar
    let privKeyBytes = doStuff();
    return privKeyBytes;
  },
};
let dashTx = DashTx.create(keyUtils);
let txraw = await dashTx.createMemo({ bytes: gobjOpReturnBytes });

let result = await RPC.request({
  method: "sendrawtransaction",
  params: [txraw.hex],
});

// poll for txid to appear in recent blocks
let txid = result.txid;

let result = await RPC.request({
  method: "gobject",
  params: [
    "submit",
    gobj.hashParent,
    gobj.revision,
    gobj.time,
    gobj.dataHex,
    txid,
  ],
});

Notes

A block is generated for a self-correcting target average of 155 seconds.
(actually 157.64 seconds over the 7 year average)

Superblock is every 16616 blocks (rounded up from 30 days).
Superblock is when payment occurs.

Voting ends 1662 blocks before the superblock (rounded up from 3 days).
 // ~(60*24*3)/2.6

Votes after the block deadline are discarded for that superblock, but will
be counted for the next, if the proposal is still active.