ConsenSys/blockapps-web3

Name: blockapps-web3

Owner: ConsenSys

Description: BlockApps Web3 Provider

Created: 2015-07-09 23:22:44.0

Updated: 2017-09-27 01:32:06.0

Pushed: 2015-11-04 00:56:26.0

Homepage: null

Size: 1377

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

BlockApps + Web3

This package provides a web3 provider for the BlockApps backend, built on top of the Hooked Web3 Provider. It allows you to use BlockApps easily in a primarily web3-based project.

This is not a wrapper around web3, so when using BlockApps + Web3, you must still include web3 in your project.

A couple considerations before using this library:

  1. BlockApps is currently in active development. Because of this, the web3 provider doesn't currently point to a server synced with the actual Ethereum network. This will change very soon.

  2. In the same vein as the above, all eth_call requests cost Ether, and are treated just like transactions sent via eth_sendTransaction.

Install

Node:

m install blockapps-web3

BlockAppsWeb3Provider = require("blockapps-web3");

Browser:

ipt type="text/javascript" src="bignumber.js"></script>
ipt type="text/javascript" src="ethereumjs-tx.js"></script> <!-- dist version -->
ipt type="text/javascript" src="web3.js"></script>
ipt type="text/javsacript" src="./build/blockapps-web3.js"></script>

Note that to avoid dependency coupling, you must include BigNumber, ethereumjs-tx, and web3 on your own when using BlockApps-Web3 in the browser. Those three dependencies must be included in the browser before including the blockapps-web3.js script.

Note: ethereumjs-tx will eventually be removed as a dependency once BlockApps is able to process raw transactions server side.

To Use:
ee below for options passed to the constructor.
provider = new BlockAppsWeb3Provider({ ... });

.setProvider(provider);

Then use web3 like normal!

Options

The BlockAppsWeb3Provider constructor takes a single parameter with the following keys:

Implemented Methods

The following lists the currently implemented methods. Some methods have restrictions: For instance, any method that takes a block number of “latest”, “earliest” or “pending” will default to “latest” regardless of what's passed to web3. Some of these restrictions are because they haven't been implemented; other restrictions are due to functionality not yet implemented by BlockApps.

Developing & Contributing

BlockApps + Web3 uses truffle to manage all parts of the project. First install truffle if you haven't already:

m install -g truffle

To build the distributable files in ./build:

uffle build

To have truffle automatically build the distributable files during development on every save:

uffle watch

To run the automated tests:

uffle test

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.