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

secp256k1.js

v3.0.1

Published

fork of secp256k1 -- using js only version for cross-platform container deploy (not optimal solution)

Downloads

2

Readme

secp256k1-node

NPM Package Build Status Dependency status

js-standard-style

This module provides native bindings to ecdsa secp256k1 functions. This library is experimental, so use at your own risk. Works on node version 0.10 or greater and in the Browser via browserify.

Installation

If you have gmp installed secp256k1 will use it. Otherwise it should fallback to OpenSSL.

  • arch pacman -S gmp
  • ubuntu sudo apt-get install libgmp-dev
from npm

npm install secp256k1

from git
git clone [email protected]:cryptocoinjs/secp256k1-node.git
cd secp256k1-node
git submodule init
git submodule update
npm install

Usage

var crypto = require('crypto')
var secp256k1 = require('secp256k1')
// or require('secp256k1/js')
//   if you want to use pure js implementation in node

// generate message to sign
var msg = crypto.randomBytes(32)

// generate privKey
var privKey
do {
  privKey = crypto.randomBytes(32)
} while (!secp256k1.privateKeyVerify(privKey))

// get the public key in a compressed format
var pubKey = secp256k1.publicKeyCreate(privKey)

// sign the message
var sigObj = secp256k1.sign(msg, privKey)

// verify the signature
console.log(secp256k1.verify(msg, sigObj.signature, pubKey))

* .verify return false for high signatures

* ECDH is not be available while bitcoin/secp256k1#352 not resolved. Right now you can use next code:

var BN = require('secp256k1/lib/js/bn')
var ECPoint = require('secp256k1/lib/js/ecpoint')
var d = BN.fromBuffer(privateKey)
var Q = ECPoint.fromPublicKey(publicKey)
return Q.mul(d).toPublicKey(true)

Elliptic vs "embedded"

secp256k1-node has pure JavaScript implementation secp256k1 based on elliptic, bn.js, hash.js. The main purpose of this implementation is more high performance, smaller size and simple code audit.

Code size:

| | browserifiable | + uglified | + gzipped | |:------:|:--------------:|:----------:|:---------:| |elliptic|303555 |211777 |62124 | |embedded|241829 |152989 |35908 | |diff |25% |38% |73% |

Performance:
$ node benchmark/benchmark.js
Set seed: 5120779d9d961dc818363811b3cf44ace2323ccf5e265749206d37442a0deac5
100% (1000/1000), 2.8s elapsed, eta 0.0s
Create 1000 fixtures
++++++++++++++++++++++++++++++++++++++++++++++++++
Benchmarking: publicKeyCreate
--------------------------------------------------
bindings x 13,945 ops/sec ±0.76% (101 runs sampled)
secp256k1js x 967 ops/sec ±0.41% (100 runs sampled)
elliptic x 838 ops/sec ±0.66% (99 runs sampled)
==================================================
Benchmarking: sign
--------------------------------------------------
bindings x 8,219 ops/sec ±0.13% (102 runs sampled)
secp256k1js x 773 ops/sec ±0.47% (98 runs sampled)
elliptic x 615 ops/sec ±0.43% (97 runs sampled)
==================================================
Benchmarking: verify
--------------------------------------------------
bindings x 5,350 ops/sec ±0.11% (103 runs sampled)
secp256k1js x 208 ops/sec ±0.19% (91 runs sampled)
elliptic x 131 ops/sec ±2.05% (87 runs sampled)
==================================================

LICENSE

This library is free and open-source software released under the MIT license.