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

@paulmillr/trusted-setups

v0.1.2

Published

Easily access KZG / ETH trusted setups in JS

Downloads

2,087

Readme

trusted-setups

Easily access KZG / ETH trusted setups in JS.

Exports 3 files:

  • index.js (default) - js-friendly trusted setup
  • fast.js - faster, decompressed trusted setup for eth-signer
  • trusted_setup.json, for c-kzg and others

Usage

npm install @paulmillr/trusted-setups

The package is located in namespace for security / anti-squatting reasons.

We test against eth-signer, kzg-wasm and c-kzg. Other libraries with similar API should also work.

import { trustedSetup } from '@paulmillr/trusted-setups';
// fast setup for eth-signer
import { trustedSetup as fast } from '@paulmillr/trusted-setups/fast.js';
// trustedSetup is { g1_lagrange: string[]; g2_monomial: string[] }

// eth-signer
import { KZG } from 'micro-eth-signer/kzg';
const kzg = new KZG(trustedSetup);

// kzg-wasm
const strip0x = items => items.map((i) => i.substring(2)).join('');
const g1 = strip0x(trustedSetup.g1_lagrange);
const g2 = strip0x(trustedSetup.g2_monomial);
const opts = { n1: 4096, n2: 65, g1, g2 };
const kzg = await loadKZG(opts);

// c-kzg can't receive object, requires path
const __dirname = dirname(fileURLToPath(import.meta.url));
ckzg.loadTrustedSetup(1, __dirname + '/trusted_setup.json');

trustedSetup.g1_lagrange.slice(0, 2)
// [
//   '0xa0413c0dcafec6dbc9f47d66785cf1e8c981044f7d13cfe3e4fcbb71b5408dfde6312493cb3c1d30516cb3ca88c03654',
//   '0x8b997fb25730d661918371bb41f2a6e899cac23f04fc5365800b75433c0a953250e15e7a98fb5ca5cc56a8cd34c20c57'
// ]
trustedSetup.g2_monomial.slice(0, 2)
// [
//   '0x93e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8',
//   '0xb5bfd7dd8cdeb128843bc287230af38926187075cbfbefa81009a2ce615ac53d2914e5870cb452d2afaaab24f3499f72185cbfee53492714734429b7b38608e23926c911cceceac9a36851477ba4c60b087041de621000edc98edada20c1def2'
// ]

Verification

npm install && npm run build will build files from trusted_setup.txt, which was copied from c-kzg-4844.

Its checksum is d39b9f2d047cc9dca2de58f264b6a09448ccd34db967881a6713eacacf0f26b7.

License

MIT License

Copyright (c) 2024 Paul Miller (https://paulmillr.com)