Installing web3.js

Web3 can be installed via npm by simply issuing the following command:

$ npm install web3 
It can also be directly downloaded from https://github.com/ethereum/web3.js.

web3.min.js, downloaded via npm, can be referred in the HTML files. This can be found under node_modules, for example,

/home/drequinox/netstats/node_modules/web3/dist/web3.js. Note that drequinox is specific to the user under which these examples were developed, you will see the user that you are running these commands under.

The file can optionally be copied into the directory where the main application is and can be used from there. Once the file is successfully referred in HTML or JS, Web3 needs to be initialized by providing an HTTP provider. This is ...

Get Mastering Blockchain - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.