Introducing BCoin, Purse’s Bitcoin Javascript Library

Introducing BCoin, Purse’s Bitcoin Javascript Library

By Ian Demartino - min read
Updated 22 May 2020

I’m no programmer, but even I know BitcoinQt (Core) is difficult to work with. Every programmer says so. Core is tried and tested but cumbersome and its development is byzantine. Enter BCoin, the Javascript bitcoin library that includes all the latest enhancement. Made by Purse specifically for its wallet and merchant backend, it is completely opensource and according to Purse, is much easier to work with than Bitcoin Core.

BCoin is a brand new implementation of Bitcoin. It isn’t a simple wallet release or something of that nature. This is a full node implementation of bitcoin, with all of the advantages that gives. There are other implementations of Bitcoin in javascript, but they are not full node implementations.

To put it in layman terms and explain why this is important. When you use any kind of wallet other than a full node implementation, you unload some tasks to a third party. Web wallets unload practically everything, from control of the private keys to verifying the blockchain.

Even wallets that give users control of the private keys offload certain tasks elsewhere. Lightweight desktop wallets that don’t include the blockchain will at least depend on other nodes or servers to confirm that the chain they are working on is the correct one. Submitting transactions to the blockchain is another task often handled by the wallet company.

Unloading these tasks to third parties, besides private key control in many situations, is fine for most users. As long as users control their private keys, they can take them to a different third party service or import them to Bitcoin Core if they desire. For enterprise applications, for merchants and web wallet hosts and casinos and exchanges, those tasks are best done locally. When handling thousands of other people’s bitcoins, it is best to cut off all attack vectors. Besides, if miners are the only group verifying the blockchain, transactions will slow and the network will be more susceptible to attacks from major pools.

It is about more than just enterprise solutions. Bitcoin developers need to be unrestrained by third party services. While many companies provide great APIs, it is impossible to develop something that will account for every idea someone comes up with. Developers often need to interact with the network directly in order to unlock its true potential.

Besides Bitcoin Core, there has only been one other full node, feature rich implementation of bitcoin: BTCD, written in Go. BTCD has been useful for developers, but there are reasons to want a javascript implementation. BCoin supports Node.js, REST APIs and Core’s JSON API. Developers should have a much easier time implementing it into web products. Javascript has also been around 12 years longer than Go, so predictably, it has more tools and packages for developers to work with. Finally, javascript is immensely more popular than Go in number of developers.

That isn’t to say BTCD and Bitcoin Core don’t have their advantages, they do. But now there is a third option, just as capable and significant as the other two. Three options is that much better than two options. Ask most Americans heading to the polls in November if they would like a third choice.

Chris Jeffery is the lead developer of BCoin. He worked at Bitpay before joining Purse as its CTO in 2015.

“Re-implementing bitcoin is difficult, however not impossible. There has been a mentality since the early days that re-implementing the consensus protocol is infeasible. I hope to prove that mentality wrong. There might be hiccups along the way, but it’s worth it in order to have an easily hackable version of bitcoin that any developer can quickly get up to speed with and start building.” Jeffery said in a statement to CoinJournal.

BCoin’s implementation includes support for SegWit, MAST, Version Bits, BIP70, BIP150, BIP151 and BIP152. Lightning Networks are also being worked on.

As mentioned, it is a full bitcoin library. So BCoin can be used to mine, in addition to everything else. In short, it can do everything Bitcoin Core can do, plus a little more, and is significantly easier to work with.

“Our goal is to accelerate the development of the protocol —  solve some scaling issues by implementing Lightning, and enable cool features that will allow for new use cases, like for instance, smart contracts.” wrote the Purse Team in the announcing blog post. “We want to make Bitcoin great again.”

Purse developed BCoin because they were dissatisfied with third parties that promised to simplify the complex aspects of running a giant merchant website. Starting today, they are moving their entire wallet backend to BCoin. As one of bitcoin’s most popular services, they hope the move will inspire other developers and services to follow suit.

You can explore the inner workings of BCoin yourself and contribute, by checking out its Github page or get updates by following its Twitter.