Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @radarrelay/web3-builder with all npm packages installed. Try it out:

var web3Builder = require("@radarrelay/web3-builder")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@radarrelay/web3-builder v0.2.0

A tool to build and manage your own Web3 instance.


A tool to build and manage your own Web3 instance.

npm version


This package simplifies the process to create your own Web3 instance, change the active wallet, and update the connection to the Ethereum network.

This is made possible using building blocks called subproviders. Subproviders are like normal web3 providers, but only handle a subset of RPC methods. They can be used to route, or otherwise handle, RPC calls before returning a result to the caller.

web3-builder uses subproviders to build out the Web3 object like so:

screen shot 2018-06-01 at 12 13 31 pm

If you'd like more flexibility when creating Web3 Providers consider using web3-provider-engine directly.



npm install @radarrelay/web3-builder


yarn add @radarrelay/web3-builder


Web3 Creation

import { Web3Builder } from '@radarrelay/web3-builder';
import { InjectedWeb3Subprovider } from '@radarrelay/subproviders';

const walletSubprovider = new InjectedWeb3Subprovider(window.web3.currentProvider);
let web3 = Web3Builder.createWeb3(walletSubprovider, InfuraNetwork.Kovan);

Update Wallet

import { EthLightwalletSubprovider } from '@radarrelay/subproviders';

const newWalletSubprovider = new EthLightwalletSubprovider(signing, keystore, pwDerivedKey);

// Updating the wallet returns a new instance of web3
web3 = Web3Builder.updateWallet(newWalletSubprovider);

Update Network

// Updating the rpc connection returns a new instance of web3
web3 = Web3Builder.updateRpcConnection(InfuraNetwork.Mainnet);

Grab the Provider

Want to use your own version of Web3?

You can grab the Ethereum Provider and instantiate your preferred version of Web3:

import * as Web3 from 'web3';

const anotherWeb3Instance = new Web3(web3.currentProvider);


import * as Web3 from 'web3';

const anotherWeb3Instance = new Web3(web3Builder.provider);


Please read for details on our code of conduct and the process for submitting pull requests.


This project is licensed under the MIT License - see the file for details.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free