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.
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 ...