Forked from Ethereum web3.js project. Change the address format rule : need a prefix: 'ai' instead of '0x'.
AICHAIN JavaScript API
You need to run a local AICHAIN node to use this library.
still can use the document of ethereum for current version. Documentation
Installation
Node.js
npm install aitweb3
Meteor.js (not supported, need upload to meteor)
meteor add aichain:aitweb3
As Browser module (not supported, need upload to Bower)
Bower
bower install aitweb3
- Include
web3.min.js
in your html file. (not required for the meteor package)
Usage
Use the web3
object directly from global namespace:
console.log(web3); // {eth: .., shh: ...} // it's here!
Set a provider (HttpProvider)
web3.setProvider(new web3.providers.HttpProvider('http://localhost:9523'));
There you go, now you can use it:
var coinbase = web3.eth.coinbase;
var balance = web3.eth.getBalance(coinbase);
You can find more examples in example
directory.
Contribute!
Requirements
- Node.js
- npm
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install nodejs-legacy
Building (gulp)
npm run-script build
Testing (mocha)
npm test