2 ms·
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 differ
by sida 12y ago
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/HierarchicalKey.js#L17-L54 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/hdnode.js#L73-L75 https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/src/h...
This function only takes a string key in base58 format.
In my experience 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.