HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
bitcoinjs
bitcoinjs-lib
JavaScript2014–2017
bitcoinjs / bitcoinjs-lib

bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.

6Distinct people
8Mentions
0Explicit recommenders
6KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A javascript Bitcoin library for node.js and browsers.

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 1:49:46 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year8 dated mentions

Observed mentions: 2014-07-02 04:32:27 UTC to 2017-09-18 09:55:47 UTC.

02462014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 6 mentions; 2 submissions, 4 comments20142015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC624
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC101
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101

What Hacker News says

8 sources
> Is there a good overview of the types of wallets, their architecture and evolution? A wallet is a userland abstraction where it groups together all of your keypairs. With each keypair (ECDSA) you have a public and private key. The address is derived from a hash and encoding of the public key. The private key is used to sign a script that unlocks the transaction outputs you have access to. For this reason, your balance is also a userland abstraction. A balance is the sum of all the outputs you have the ability to unlock by signing the input. Whats important to understand about transactions is that you need to spend the entire input. If you have 10 coin sitting in an output and want to send 7 to someone, you need to structure the transaction so that the 3 change goes back to you as well The way fees work is that the miner picks up any dif
Read the rest
ference between the outputs and the input, for ex. 10 input => output 1 = 7btc to address1 (recipient) => output 2 = 2.9btc to address2 (change) => diff 0.1 btc transaction fee You now have a balance of 0 in your input address, and you're left with 2.9btc in your change address which will become the input on your next transaction There is no reason why the change address cannot be the same as the input, but it means a loss of privacy since you can then see the 2.9 btc was change, thus output1 was the recipient, and you link the future transaction back to yourself as well. If you then want to send 11 coin to someone, you can combine other inputs: 2.9btc input => output 1 = 11btc to address3 (recipient) 10btc input => output 2 = 1.89btc to address4 (change) => diff 0.1 btc transaction fee This is how wallet identification works as described in the OP - you can assume that any inputs shared in a transaction are from the same owner since they were signed together. If you parse the blockchain and continue grouping common inputs like that you end up with a graph of wallets. Sometimes it only requires a single transaction to group together entire clusters - especially if you're using wallet software that selects inputs to use in sequence, doesn't create change correctly, or if you sweep all your smaller and smaller inputs into an aggregate address What the original wallets did, and what OP explains, is they would pre-generate the next 100 keypairs and add them to the end of the list, and with each transaction that requires change it would move the pointer for next change address up one All of your addresses start as either receive addresses, or as change addresses, and end up becoming your balance addresses until they are spent To backup these wallets you had to backup every key pair, which is why most modern wallets use deterministic keys usually derived from a mneumonic. HD wallets use a master key pair, where the private key is usually derived from a mneumonic. That key pair is then used to generate the key chains that are used as receive and change addresses. It means you only need to backup your master keypair or your master mnemonic and can then generate and check all the key chains The new wallet format is defined in bip32 [0] while the mnemonic to generate seeds is defined in bip39[1] - which you can test using a browser client app[2] (don't store coin using these - generate them securely) Most wallets now support these deterministic wallets, including bitcoin core The three main wallet types are full node, thin node (SPV) or web wallet You can run a full node with Bitcoin Core[3] or Bcoin[4] (a Javascript implementation) - both support pruning the blockchain at a specified block height The most popular SPV clients are Electrum[5] cross-platform, breadwallet for ios/android[6]. SPV uses block headers and peer queries (sometimes using bloom filters for privacy) to query your unspent transaction outputs and to verify transactions (there are variations of the architecture). The bcoin project also allows you to run an SPV client in the browser or via node (i'm really starting to like this project - they were the first to implement p2p authentication and encryption which is specified in bip150/bip151) Electrum supports Trezor and hardware wallets, multisig wallets, 2FA wallets and have their own mnumonic and deterministic wallet format (but it also just involves saving a seed for the master key) Web wallets store your wallet (usually) encrypted on their server and then unpack and decrypt in your browser client, then making HTTP API queries to verify transactions, get your unspents, broadcast transactions etc. The most popular are Blockchain.info[7] (disclaimer: I worked for them) and GreenAddress[8] - you can use blockchain.info via a tor hidden service at blockchainbdgpzk.onion Good ways of getting started if you're more interested in the tech is Electrum (web wallets tend to obfusacte a lot of what is going on to make them easy to use), a full node with Bitcoin Core or running bcoin - and running them on testnet so you can build and broadcast your own transactions without fear of losing funds (the scripting language has also evolved a lot). The other Javascript lib you can use to create transactions is bitcoinjs-lib[9] - there are libs available for deterministic wallets and some good transaction/script abstractions. [0] https://github.com/bitcoin/bips/blob/master/bip-0032.mediawi... [1] https://github.com/bitcoin/bips/blob/master/bip-0039.mediawi... [2] https://iancoleman.github.io/bip39/ [3] https://bitcoincore.org/ [4] https://github.com/bcoin-org/bcoin [5] https://electrum.org/ [6] https://breadwallet.com/ [7] https://blockchain.info/wallet/#/home [8] https://greenaddress.it/en/ [9] https://github.com/bitcoinjs/bitcoinjs-lib
In How the Bitcoins Were Stolen from Mt. Gox [video]
The graph displayed of ECDSA duplicate r-value exploits shows 2 prominent "columns" of addresses, the latter of which was in April/May 2014. That latter column was directly related to a commit that I made to the bitcoinjs-lib master branch (which was undergoing major refactoring at the time). The commit that fixed the issue: https://github.com/bitcoinjs/bitcoinjs-lib/commit/bc37e65014... The issue itself was that a `Buffer` was being interpreted as `0` by crypto-js's cryptographic hash functions in our implementation of RFC6979, thus creating a case of duplicate `k` values. The second most interesting point was the majority of the funds (>20k USD) stolen from Counterparty (the only known users of our master branch at that time) was returned by a grey hat.
In Stealing Bitcoin with Math
It's an exciting time to be a JavaScript developer for Bitcoin. There are a number of JavaScript libraries for Bitcoin. Here is a comprehensive list of alternatives to Bitcore: - https://github.com/bitcoinjs/bitcoinjs-lib (one of the best) - https://github.com/indutny/bcoin (Indutny's work is found throughout Node.js and is the basis of elliptic curve cryptography in Bitcore) - https://github.com/ryanxcharles/fullnode (ex-developer of Bitcore and now engineer at Reddit behind Reddit's crypto currency initiative) - http://cryptocoinjs.com/ (disclosure: I started this one) Here is an older article that I wrote about understanding how an Address is created (still valid, but using an older version of bitcoinjs-lib): http://procbits.com/2013/08/27/generating-a-bitcoin-address-... The cool thing is that you can use test Bitcoins without any ris
Read the rest
k to learn how to program for Bitcoin. Use these faucets: http://tpfaucet.appspot.com/ and http://faucet.xeno-genesis.com/ Here is a very simple wallet that I built to demonstrate how easy it is to build one: https://github.com/coinbolt/simple-wallet Finally, an open source app to test the purchasing experience of Bitcoin: https://github.com/coinbolt/catshop
In Bitcore – A pure JavaScript Bitcoin API
And don't forget the end-to-end project[1], which is the javascript crypto library by google. The significance of these types of project extend beyond browser privacy. As crypto-currency become more prominent, we NEED better, carefully auditted javascript crypto-libraries. Right now, all the crypto-code are home baked. e.g.: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/e... While, I think they are all doing a fine job. It is not settling to think that these mission critical, crypto-code is not vetted by cryptographers. In fact, a few months ago, there was a bug where the nonce for each signature was not set properly that basically meant you were able to work out the private key for 2 different signatures. Some users lost funds due to the bug. These open initiatives will lay an important foundation. [1]https://code.google.com
Read the rest
In Security for the people
Its not really a bug, the operations after it would still be valid (it is almost immediately reduced to the field order), its just that those parameters would not be akin to the SEC paper specification. I agree that the honus isn't on the users to check that though, so I'm probably going to make a pull request to change this.[1] [1] https://github.com/bitcoinjs/bitcoinjs-lib/pull/250
In BitcoinJS
You are correct. Both projects come from Stefan Thomas's original BitcoinJS. Both projects (bitcore vs bitcoinjs) are very similar. I would say the main difference you will find is mostly at a DSL level. I find that bitcoinjs has nicer syntax than bitcore. Bitcore has a fairly loose syntax. And a function can takes many different types of argument. As an example: https://github.com/bitpay/bitcore/blob/master/lib/Hierarchic... If you pass no argument, it defaults to a new BIP32 key on mainnet. Or you can pass in a network argument, or you can pass in a string private key. Bitcoinjs-lib on the other hand, enforces fairly strict typing on functions. Functions often only take one particular type, as an example: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/h... This function only takes a string key in base58 format. In my experie
Read the rest
nce of using both, it is easy to have programmer error in bitcore, because its syntax is so loose. Whereas it is a lot harder to make programmer errors in bitcoinjs-lib. Given that this is financial software, I prefer the bitcoinjs-lib approach. For example, One problem I encountered with bitcore was I made a mistake in the derivation path of a bip32 key. Instead path of 'M/1/0/1', I mistakenly used 'M/1/0/1/undefined'. Bitcore happily derived a key for me. This is the type of errors you don't tend to get with bitcoinjs.
In BitcoinJS

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.