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

@based-labs/drand-quicknet

v0.1.0-alpha.1

Published

Utilities for fetching and working with drand Quicknet randomness.

Readme

@based-labs/drand-quicknet

Utilities for fetching and working with drand Quicknet randomness.

This package provides:

  • Quicknet round/time calculations
  • Beacon fetching with endpoint failover
  • Compressed signature parsing
  • BLS signature decompression
  • Quicknet constants and types

Installation

pnpm add @based-labs/drand-quicknet

Requires Node.js 24 or later.

Usage

Fetch a beacon

import {
  fetchBeacon,
} from '@based-labs/drand-quicknet';

const beacon = await fetchBeacon(31_250_000n);

console.log(beacon.round);
console.log(beacon.signature);

fetchBeacon() tries the default Quicknet endpoints in order and returns the first successful response.

You can provide your own endpoint list:

const beacon = await fetchBeacon(
  31_250_000n,
  [
    'https://example.com/v2',
  ],
);

Fetch from a specific endpoint

import {
  fetchBeaconFromEndpoint,
} from '@based-labs/drand-quicknet';

const beacon = await fetchBeaconFromEndpoint(
  'https://api.drand.sh/v2',
  31_250_000n,
);

Round calculations

import {
  roundAt,
  roundScheduledTime,
} from '@based-labs/drand-quicknet';

const round =
  roundAt(
    BigInt(Math.floor(Date.now() / 1000)),
  );

const scheduledTime = roundScheduledTime(round);

roundAt() returns 0n for timestamps before the Quicknet genesis timestamp.

roundScheduledTime() throws for round 0n.

Decompress a Quicknet signature

Quicknet beacon signatures are returned in compressed form.

import {
  decompressSignature,
  fetchBeacon,
} from '@based-labs/drand-quicknet';

const beacon = await fetchBeacon(31_250_000n);

const uncompressed = decompressSignature(beacon.signature);

Parse a compressed signature

import {
  parseCompressedSignature,
} from '@based-labs/drand-quicknet';

const signature =parseCompressedSignature('...');

The parser validates that the value is a 48-byte hexadecimal Quicknet signature and returns a branded CompressedSignature.

Constants

import {
  QUICKNET_ENDPOINTS,
  QUICKNET_GENESIS_TIMESTAMP,
  QUICKNET_PERIOD_SECONDS,
} from '@based-labs/drand-quicknet';

Current exported values include:

  • QUICKNET_GENESIS_TIMESTAMP
  • QUICKNET_PERIOD_SECONDS
  • QUICKNET_ENDPOINTS

Quicknet currently uses a 3-second period.

API

Functions

  • fetchBeacon(round, endpoints?)
  • fetchBeaconFromEndpoint(endpoint, round)
  • roundAt(timestamp)
  • roundScheduledTime(round)
  • decompressSignature(signature)
  • parseCompressedSignature(signature)

Types

  • QuicknetBeacon
  • CompressedSignature
  • UncompressedSignature
  • Hex

Verification

This package fetches, validates the shape of, and manipulates Quicknet beacon data. It does not cryptographically verify a beacon signature.

For EVM applications using the Based Labs Quicknet beacon registry, see @based-labs/drand-quicknet-registry.

License

MIT