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

@rolly-dev/wasm-signer

v0.12.0

Published

Poseidon2 hashing & bet signing for Rolly ZK-Rollup (WASM, Goldilocks field)

Readme

@rolly-dev/wasm-signer

Client-side Poseidon2 hashing and bet authentication for the Rolly ZK-Rollup casino.

Built with Rust → WebAssembly (via wasm-pack), using the same Poseidon2 hasher and Goldilocks field as the plonky2 proving circuit.

Build

# requires: cargo, wasm-pack
npm run build
# → dist/node/  (Node.js, CJS, sync init)
# → dist/web/   (Browser, ESM, async init)

Usage

Node.js (CommonJS)

const {
  poseidon2_hash,
  derive_session_key,
  session_public_key,
  create_bet_auth,
} = require('@rolly-dev/wasm-signer');

const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
// → BigUint64Array(4)

Node.js (ESM)

import {
  poseidon2_hash,
  derive_session_key,
  create_bet_auth,
} from '@rolly-dev/wasm-signer';

const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));

React

import { useRollyWasm } from '@rolly-dev/wasm-signer/react';

function BetButton({ sessionKey, amount, nonce }) {
  const { ready, create_bet_auth } = useRollyWasm();

  if (!ready) return <span>Loading...</span>;

  const handleBet = () => {
    const auth = create_bet_auth(sessionKey, BigInt(amount), BigInt(nonce));
    // send auth to server...
  };

  return <button onClick={handleBet}>Place Bet</button>;
}

Browser (vanilla ESM)

<script type="module">
  import { init, poseidon2_hash } from '@rolly-dev/wasm-signer';

  await init();  // loads .wasm, must be called once
  const h = poseidon2_hash(BigUint64Array.from([1n, 2n]));
</script>

Manual init (advanced)

import init, { poseidon2_hash } from '@rolly-dev/wasm-signer/init';

// custom wasm URL or ArrayBuffer
await init('/assets/rolly_wasm_signer_bg.wasm');
poseidon2_hash(BigUint64Array.from([1n]));

API

| Function | Input | Output | Description | |----------------------------|--------------------------------|-------------------|------------------------------------------------| | poseidon2_hash | BigUint64Array | BigUint64Array(4) | Hash N field elements | | poseidon2_two_to_one | BigUint64Array(4) × 2 | BigUint64Array(4) | Merkle hash: H(left‖right) | | derive_session_key | Uint8Array(32) | BigUint64Array(4) | MetaMask sig → session key | | session_public_key | BigUint64Array(4) | BigUint64Array(4) | session_pk = H(session_key) | | create_bet_auth | (BigUint64Array(4), bigint, bigint) | BigUint64Array(4) | MAC = H(sk‖amount_lo‖amount_hi‖nonce) | | compute_server_seed_hash | BigUint64Array(8) | BigUint64Array(4) | Full hash of server seed | | seed_hash_truncated | BigUint64Array(8) | BigUint64Array(2) | First 2 elements (circuit leaf format) | | goldilocks_modulus | — | bigint | Returns p = 2^64 - 2^32 + 1 | | goldilocks_reduce | bigint | bigint | Reduce mod p |

Bundler notes

Vite — add to optimizeDeps.exclude:

optimizeDeps: { exclude: ['@rolly-dev/wasm-signer'] }

Webpack 5 — enable WASM experiments:

module.exports = { experiments: { asyncWebAssembly: true } };

Next.js — conditional exports auto-resolve: Node.js entry on server, browser entry on client.

License

MIT