npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blockapps-web3

v1.1.8

Published

A Web3 Provider for the BlockApps backend

Downloads

13

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:

$ npm install blockapps-web3
var BlockAppsWeb3Provider = require("blockapps-web3");

Browser:

<script type="text/javascript" src="bignumber.js"></script>
<script type="text/javascript" src="ethereumjs-tx.js"></script> <!-- dist version -->
<script type="text/javascript" src="web3.js"></script>
<script 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:

// See below for options passed to the constructor.
var provider = new BlockAppsWeb3Provider({ ... });

web3.setProvider(provider);

Then use web3 like normal!

Options

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

  • transaction_signer: See Hooked Web3 Provider. BlockAppsWeb3Provider is an extension of the HookedWeb3Provider, using a separate service for signing transactions.
  • coinbase: string - the coinbase address associated with eth_coinbase. You only need to specify this value if your app will call eth_coinbase via web3.
  • accounts: array - the addresses associated with this provider. You only need to specify this value if your app will call eth_accounts via web3.
  • host: string - location of the BlockApps server this provider will point to. Defaults to http://hacknet.blockapps.net (for now)

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.

  • eth_coinbase
  • eth_accounts
  • eth_blockNumber
  • eth_getBlockByNumber (does not support "pending"; partially implemented, needs work)
  • eth_call
  • eth_sendTransaction
  • eth_sendRawTransaction
  • eth_getCompilers
  • eth_compileSolidity
  • eth_getCode (does not support "pending")
  • eth_getBalance
  • eth_getTransactionCount (does not support "pending")
  • eth_getTransactionByHash
  • eth_getTransactionReceipt
  • eth_newBlockFilter
  • eth_getFilterChanges (only supports block filters)
  • eth_uninstallFilter
  • web3_clientVersion

Developing & Contributing

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

$ npm install -g truffle

To build the distributable files in ./build:

$ truffle build

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

$ truffle watch

To run the automated tests:

$ truffle test