$4,046.32 -0.25%
BTC · 41w

Just released: a WebAssembly version of Bitcoin's Secp256k1 (10x faster than Javascript)

Just released: WebAssembly version of Secp256k1 (10x faster than Javascript)

Bitcoin, Bitcoin Cash, and most other cryptocurrencies use the Elliptic Curve Digital Signature Algorithm (ECDSA) to authenticate transactions. ECDSA can be used with a number of different elliptic curves, and Bitcoin’s creator chose the Koblitz curve Secp256k1 for Bitcoin’s digital signature system.

Secp256k1 is used by most cryptocurrency software

Most software packages which interact with these systems require Secp256k1 support. Mining software must be able to validate that transactions are properly signed before being included in the blockchain. Cryptocurrency wallets must be able to both verify incoming transactions and sign transactions to spend funds.

Many of the most popular cryptocurrency wallets and services are written in JavaScript. For these applications, Secp256k1 signing and validation can be complicated to package, use, and audit – often requiring different build and code paths for the browsers than those required for Node.js – and relatively slow (especially in browser applications).

Get the library on GitHub or NPM

A WebAssembly version of libsecp256k1 is now available on GitHub and via the Node.js package manager, NPM:

npm install --save bitcoin-ts

The API is purely-functional, fully-typed and documented with TypeScript, and accepts and returns native ES2015 typed arrays. Here’s a short example of Low-S signature verification using the library:

The library is written in TypeScript and documented inline, so capable editors will show documentation as you type:

For more usage information, review the code, the tests, or check out the Secp256k1 Interface in the TypeDocs.

Thoroughly tested against existing implementations

Along with standard test vectors and 100% code coverage, the library uses property-based testing to randomly generate thousands of test cases each run, including comparisons of ...

Continue on
Recent news
BTC -0.25% · · 9h

Blockchain and Crypto Businesses Protest New Nevada Bill

Representatives within the blockchain and cryptocurrency community recently voiced their concerns about a proposed bill in the Nevada State Senate during a Judiciary Committee last Tuesday, March 12. ...
BTC -0.25% · · 10h

How to earn bitcoin by using BTCPay server

Don’t buy bitcoin – earn it. Why? It’s better for your privacy. You’re not sharing data with sketchy custodians nor trusting third-parties with your hard-earned funds. Your money, your rules. By getti...
BTC -0.25% · · 11h

Bitcoin is not Money Because it Cannot be issued Says ECB

The European Central Bank (ECB) recently held an #AskECB event on Twitter and invited ECB chief economist Peter Praet to have a direct dialogue with netizens. The question was initiated by the netizen...