Web3 ProviderEngine is a tool for composing your own web3 providers.
Built to be modular - works via a stack of 'sub-providers' which are like normal web3 providers but only handle a subset of rpc methods.
The subproviders can emit new rpc requests in order to handle their own; e.g.
platon_call may trigger
platon_getCode, and others.
The provider engine also handles caching of rpc request results.
const ProviderEngine =const CacheSubprovider =const FixtureSubprovider =const FilterSubprovider =const VmSubprovider =const HookedWalletSubprovider =const NonceSubprovider =const RpcSubprovider =var engine =var web3 = engine// static resultsengine// cache layerengine// filtersengine// pending nonceengine// vmengine// id mgmtengine// data sourceengine// log new blocksengine// network connectivity errorengine// start polling for blocksenginestart
When importing in webpack:
Built For Zero-Clients
The Ethereum JSON RPC was not designed to have one node service many clients. However a smaller, lighter subset of the JSON RPC can be used to provide the blockchain data that an Ethereum 'zero-client' node would need to function. We handle as many types of requests locally as possible, and just let data lookups fallback to some data source ( hosted rpc, blockchain api, etc ). Categorically, we don’t want / can’t have the following types of RPC calls go to the network:
- id mgmt + tx signing (requires private data)
- filters (requires a stateful data api)
- vm (expensive, hard to scale)
- default dataProvider for zero is Infura mainnet REST api
- websocket support
- subscriptions support
- remove solc subprovider
distfrom git (but published in npm module)
- es5 builds in
- zero + ProviderEngine bundles are es5
- web3 subprovider renamed to provider subprovider
- error if provider subprovider is missing a proper provider
- removed need to supply getAccounts hook
- txs included in blocks via
- moved block polling to
- zero.js - replaced http subprovider with fetch provider (includes polyfill for node).
- renamed HookedWalletSubprovider
pollingShouldUnrefoption now defaults to false