Node.js is a server-side software system designed for writing scalable Internet applications, notably web servers.
It is build on built on Chrome's JavaScript runtime.
Programs are written on the server side in JavaScript, using event-driven, asynchronous I/O to minimize overhead
and maximize scalability.
Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software,
such as Apache or Lighttpd, and allowing more control of how the web server works. Node.js enables web developers to
create an entire web application in JavaScript, both server-side and client-side.
The latest Node.js version can be downloaded from:
http://nodejs.org
Even numbered versions (0.4, 0.6, 0.8) are stable, and odd numbered versions (0.3, 0.5) are unstable.
The stable releases are API-stable, which means that if you are using 0.8.1 and 0.8.2 comes out, you should be able to upgrade with no issues.
How to browserify bitcore-lib and bitcore-mnemonic
Information
Browserify will recursively analyze all the require() calls in your app in order to build
a bundle you can serve up to the browser in a single <script> tag.
More information see:
http://browserify.org/
https://github.com/bitpay/bitcore-lib
https://github.com/bitpay/bitcore-mnemonic
https://github.com/bitpay/bitcore
https://bitcore.io/guides/browser
Operating system used
macOS 10.12 Sierra
Software prerequisites
node.js
Procedure
- Install browserify.
Type: npm install -g browserify
- Show all installed node modules and their versions.
Type: npm -g ls --depth=0
You should see:
[email protected]
- Show browserify help.
Type: browserify --help
- Install uglifyjs.
Type: npm install -g uglifyjs
- Show uglifyjs help.
Type: uglifyjs --help
- Show all installed node modules and their versions.
Type: npm -g ls --depth=0
You should see:
[email protected]
- In the following example "bitcore-lib" and "bitcore-mnemonic" will be browserified.
- Create a project directory.
Type: mkdir ~/bitcore
- Install the node modules "bitcore-lib" and "bitcore-mnemonic" locally inside this folder.
Type: cd ~/bitcore
Type: npm install bitcore-lib
Type: npm install bitcore-mnemonic
The node modules are now installed in folder cd ~/bitcore/node_modules
I have installed bitcore-lib v0.14.0 and bitcore-mnemonic v1.2.5
- Create a file index.js inside this folder.
Type: touch ~/bitcore/index.js
- Enter the following lines in file index.js
var bitcore = require('bitcore-lib');
var Mnemonic = require('bitcore-mnemonic');
- Browserify the node modules
Type: browserify -r bitcore-lib | uglifyjs > bitcore-lib.min.js
Type: browserify -r bitcore-mnemonic --external bitcore-lib | uglifyjs > bitcore-mnemonic.min.js
- The files bitcore-lib.min.js and bitcore-mnemonic.min.js are created.
How these libraries are used see: Online Ethereum tools
|
|