Name: web3.js
Owner: ethereum
Description: Ethereum JavaScript API
Created: 2014-09-30 20:50:37.0
Updated: 2018-01-17 18:58:55.0
Pushed: 2018-01-17 17:13:32.0
Size: 28092
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
web3.js version 0.14.0 supports multiple instances of web3 object. To migrate to this version, please follow the guide:
web3 = require('web3');
Web3 = require('web3');
web3 = new Web3();
This is the Ethereum compatible JavaScript API which implements the Generic JSON RPC spec. It's available on npm as a node module, for bower and component as an embeddable js and as a meteor.js package.
You need to run a local Ethereum node to use this library.
install web3
add web3
or add ethereum:web3
Bower
r install web3
Component
onent install ethereum/web3.js
web3.min.js
in your html file. (not required for the meteor package)Use the web3
object directly from global namespace:
ole.log(web3); // {eth: .., shh: ...} // it's here!
Set a provider (HttpProvider)
typeof web3 !== 'undefined') {
b3 = new Web3(web3.currentProvider);
se {
set the provider you want from Web3.providers
b3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
Set a provider (HttpProvider using HTTP Basic Authentication)
.setProvider(new web3.providers.HttpProvider('http://host.url', 0, BasicAuthUsername, BasicAuthPassword));
There you go, now you can use it:
coinbase = web3.eth.coinbase;
balance = web3.eth.getBalance(coinbase);
You can find more examples in example
directory.
apt-get update
apt-get install nodejs
apt-get install npm
apt-get install nodejs-legacy
run-script build
test