Gathering detailed insights and metrics for @trufflesuite/web3-provider-engine
Gathering detailed insights and metrics for @trufflesuite/web3-provider-engine
Gathering detailed insights and metrics for @trufflesuite/web3-provider-engine
Gathering detailed insights and metrics for @trufflesuite/web3-provider-engine
A JavaScript library for composing Ethereum provider objects using middleware modules.
npm install @trufflesuite/web3-provider-engine
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
5 Stars
833 Commits
12 Forks
3 Watchers
42 Branches
6 Contributors
Updated on Mar 11, 2024
Latest Version
15.0.14
Package Id
@trufflesuite/web3-provider-engine@15.0.14
Size
869.70 kB
NPM Version
6.14.14
Node Version
12.22.0
Published on
Nov 02, 2021
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
22
Web3 ProviderEngine is a tool for composing your own web3 providers.
Originally created for MetaMask, but has been superceded by json-rpc-engine in combination with our eth-json-rpc-middleware. This module is not very actively maintained, so we recommend using that one instead.
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. eth_call
may trigger eth_getAccountBalance
, eth_getCode
, and others.
The provider engine also handles caching of rpc request results.
1const ProviderEngine = require('web3-provider-engine') 2const CacheSubprovider = require('web3-provider-engine/subproviders/cache.js') 3const FixtureSubprovider = require('web3-provider-engine/subproviders/fixture.js') 4const FilterSubprovider = require('web3-provider-engine/subproviders/filters.js') 5const VmSubprovider = require('web3-provider-engine/subproviders/vm.js') 6const HookedWalletSubprovider = require('web3-provider-engine/subproviders/hooked-wallet.js') 7const NonceSubprovider = require('web3-provider-engine/subproviders/nonce-tracker.js') 8const RpcSubprovider = require('web3-provider-engine/subproviders/rpc.js') 9 10var engine = new ProviderEngine() 11var web3 = new Web3(engine) 12 13// static results 14engine.addProvider(new FixtureSubprovider({ 15 web3_clientVersion: 'ProviderEngine/v0.0.0/javascript', 16 net_listening: true, 17 eth_hashrate: '0x00', 18 eth_mining: false, 19 eth_syncing: true, 20})) 21 22// cache layer 23engine.addProvider(new CacheSubprovider()) 24 25// filters 26engine.addProvider(new FilterSubprovider()) 27 28// pending nonce 29engine.addProvider(new NonceSubprovider()) 30 31// vm 32engine.addProvider(new VmSubprovider()) 33 34// id mgmt 35engine.addProvider(new HookedWalletSubprovider({ 36 getAccounts: function(cb){ ... }, 37 approveTransaction: function(cb){ ... }, 38 signTransaction: function(cb){ ... }, 39})) 40 41// data source 42engine.addProvider(new RpcSubprovider({ 43 rpcUrl: 'https://testrpc.metamask.io/', 44})) 45 46// log new blocks 47engine.on('block', function(block){ 48 console.log('================================') 49 console.log('BLOCK CHANGED:', '#'+block.number.toString('hex'), '0x'+block.hash.toString('hex')) 50 console.log('================================') 51}) 52 53// network connectivity error 54engine.on('error', function(err){ 55 // report connectivity errors 56 console.error(err.stack) 57}) 58 59// start polling for blocks 60engine.start()
When importing in webpack:
1import * as Web3ProviderEngine from 'web3-provider-engine'; 2import * as RpcSource from 'web3-provider-engine/subproviders/rpc'; 3import * as HookedWalletSubprovider from 'web3-provider-engine/subproviders/hooked-wallet';
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:
eth-json-rpc-engine
babelify@10
+ @babel/core@7
dist
from git (but published in npm module)dist/es5
hooked-wallet-ethtx
message signinghooked-wallet
default txParamseth-block-tracker
@2.0.0eth-block-tracker
.personalRecoverSigner
to recoverPersonalSignature
pollingShouldUnref
option now defaults to falseNo vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 5/21 approved changesets -- score normalized to 2
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
74 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More