Theos & Hyperdapp JavaScript API, middleware to talk to a theos node over RPC
npm install web4js
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 embeddable scripts, and as a meteor.js package.
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] [![Coverage Status][coveralls-image]][coveralls-url] [![Stories in Ready][waffle-image]][waffle-url]
You need to run a local Ethereum node to use this library.
- Installation
- Node.js
- Yarn
- Meteor.js
- As a Browser module
- Usage
- Migration from Web3.js to Web4.js
- Contribute!
- Requirements
- Building (gulp)
- Testing (mocha)
- Community
- Other implementations
- License
``bash`
npm install web4js
`bash`
yarn add web4js
`bash`
meteor add hyperdapp:web4js
CDN
`html`
Bower
`bash`
bower install web4js
Component
`bash`
component install hyperdapp/web4.js
* Include web4.min.js in your html file. (not required for the meteor package)
Use the web4 object directly from the global namespace:
`js`
console.log(web4); // {eth: .., shh: ...} // It's here!
Set a provider (HttpProvider):
`js`
if (typeof web4 !== 'undefined') {
web4 = new web4(web4.currentProvider);
} else {
// Set the provider you want from web4.providers
web4 = new web4(new web4.providers.HttpProvider("http://localhost:8545"));
}
Set a provider (HttpProvider using HTTP Basic Authentication):
`js`
web4.setProvider(new web4.providers.HttpProvider('http://' + BasicAuthUsername + ':' + BasicAuthPassword + '@localhost:8545'));
There you go, now you can use it:
`js`
var coinbase = web4.eth.coinbase;
var balance = web4.eth.getBalance(coinbase);
You can find more examples in the example directory.
web4.js is derived from web3.js of Ethereum web3 .
To migrate to this framework, please follow the guide:
``
+Run/Connect to Theos Blockchain;
+Deploy Smart Contract;
+Install Smart Contract on Hyperdapp;Contribute!
* Node.js
* npm
`bash`On Linux:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
sudo apt-get install nodejs-legacy
`bash`
npm run-script build
`bash``
npm test
MIT © 2018 Contributors
LGPL-3.0+ © 2015 Contributors
For any omissions, please contact us at info@hyperdapp.org
[npm-image]: https://badge.fury.io/js/web4.svg
[npm-url]: https://npmjs.org/package/web4
[travis-image]: https://travis-ci.org/hyperdapp/web4.js.svg
[travis-url]: https://travis-ci.org/hyperdapp/web4.js
[dep-image]: https://david-dm.org/hyperdapp/web4.js.svg
[dep-url]: https://david-dm.org/hyperdapp/web4.js
[dep-dev-image]: https://david-dm.org/hyperdapp/web4.js/dev-status.svg
[dep-dev-url]: https://david-dm.org/hyperdapp/web4.js#info=devDependencies
[coveralls-image]: https://coveralls.io/repos/hyperdapp/web4.js/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/r/hyperdapp/web4.js?branch=master
[waffle-image]: https://badge.waffle.io/hyperdapp/web4.js.svg?label=ready&title=Ready
[waffle-url]: https://waffle.io/hyperdapp/web4.js