question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to browserify the complete bitcoinjs-lib?

See original GitHub issue

Previously I remember the install instructions for browserify contained something like browserify bitcoinjs-lib -s bitcoin > bitcoinjs.js to build a standalone version of bitcoinjs.

Nowadays the instructions contain instructions to create an index.js with a myFunction which does one particular thing (creating a random private key, in this case) and then exports that function.

How do I just export everything, i.e. create the entire bitcoinjs lib that I can include in a .html file just like before?

Perhaps a stupid question, in that case my apologies, but other than bitcoinjs I never used browserify for anything else and I’m not quite sure how this works.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:31 (15 by maintainers)

github_iconTop GitHub Comments

4reactions
SuperHenkiecommented, Feb 7, 2018

@EvilJordan sure:

  1. Make sure nodejs and npm are up to date

  2. Create a new dir and from within that dir do npm install bitcoinjs-lib browserify uglify-es

  3. Create an index.js file in the same dir with this content:

var bitcoin_js = require('bitcoinjs-lib')
bitcoin_js.bigi = require('bigi')
bitcoin_js.Buffer = require('safe-buffer').Buffer
module.exports = bitcoin_js
  1. browserify -r . --standalone bitcoinjs > bitcoinjs.js

  2. uglifyjs -c --mangle reserved=['BigInteger','ECPair','Point'] bitcoinjs.js > bitcoinjs.min.js

This creates both the full bitcoinjs.js and minified bitcoinjs.min.js.

1reaction
EvilJordancommented, Apr 9, 2020

Not the most informative, but I completely removed browserify from my system, reinstalled it, and now everything works ¯\_(ツ)_/¯

Thanks for your help, @junderw!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to compile BitcoinJS for browsers - Stack Overflow
I have compiled the bitcoinjs library with this command in CMD of Windows OS: ... cmd> browserify -r bitcoinjs-lib -s Bitcoin | uglifyjs...
Read more >
bitcoinjs-lib-browser - npm
Browserified bundle for bitcoinjs-lib: Client-side Bitcoin Javscript ... Start using bitcoinjs-lib-browser in your project by running `npm i ...
Read more >
BitcoinJS (bitcoinjs-lib) - JavaScript on Fiber - FIBJS
Standardized: Node community coding style, Browserify, Node's stdlib and Buffers. Fast: Optimized code, uses typed arrays instead of byte arrays for performance ...
Read more >
bitcoinjs-lib | Yarn - Package Manager
BitcoinJS (bitcoinjs-lib) ... A javascript Bitcoin library for node.js and browsers. ... Display full readme Display full readme ...
Read more >
Installing and using bitcoinjs. - Mobilefish.com
Node.js enables web developers to create an entire web application in JavaScript, ... Open a terminal and type:npm install bitcoinjs-lib -g
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found