Install
There are two ways to install the Aion version of Web3.js. Using the minified JavaScript file from the Aion Web3.js repository is the fastest and easiest way to get up and running with Web3.js. This method is also the easiest way to link up a website frontend. However, if you want to deal with the blockchain in a more backend-way, then you should look at using the Node JS console section.
Minified JavaScript File
This is the easiest option since it doesn’t require you to have NPM install.
1. Go to the aion_web3
GitHub repository releases page.
2. Find the latest release and download the web3.min.js
file.
3. Add the web3.min.js
file into your project folder:
4. In your HTML
, add include the web3.min.js
file before you call any other JavaScript files. This is the make sure that your JavaScript has access to the Web3
object created by the web3.min.js
file.
5. You should now be able to use the Web3
object within your JavaScript.
Node JS Console
Follow this process if you want to add Web3.js into a node project, or you want to use the Web3.js console.
1. Clone the aion_web3
GitHub repository:
2. Move into the directory and install the dependencies:
If you run into an error here, it may be because you don’t have lerna
installed. You can fix this by running npm install lerna
, and then re-running npm install
.
3. The Web3.js package is now installed in this location. You can run the console by calling it:
If you want to open the console and automatically connect to a node, supply the node URL as an argument when calling console.js
:
4. You can now interact with the node using Web3.js: