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 ethereumjs/ethereumjs-wallets
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://www.npmjs.com/package/bip39
https://github.com/ethereumjs/ethereumjs-wallet
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 uglify-es.
Type: npm install -g uglify-es
Note:
Use module uglify-es instead of uglifyjs.
When uglifyjs hdkey.js i got an "const" error message.
const is an ES6 feature, and support in uglify-js 2.x has known issues, so it was removed in uglify-js 3.x as ES6 users should be using uglify-es instead.
- 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 "ethereumjs/ethereumjs-wallets" will be browserified.
Goto https://github.com/ethereumjs/ethereumjs-wallet
and download a release version, for example: v0.6.0.
Unzip to folder ~/ethereumjs-wallet-0.6.0.
- Type: cd ~/ethereumjs-wallet-0.6.0
- Browserify hdkey.js:
Type: browserify -s hdkey hdkey.js | uglifyjs > hdkey.min.js
Note:
You can also browserify the thirdparty library:
Type: browserify -s thirdparty thirdparty.js | uglifyjs > thirdparty.min.js
- How the hdkey.min.js library is used in a test.html file:
:
<script type="text/javascript" src="../../scripts/ethereumjs-wallet/hdkey.min.js"> </script>
:
const hdwallet = hdkey.fromMasterSeed(seed);
})
See an example: Online Ethereum tools
|
|