All Projects → floating → eth-provider

floating / eth-provider

Licence: GPL-3.0 license
A Universal Ethereum Provider Client

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to eth-provider

ESSE
Encrypted peer-to-peer system for data security. Own data, own privacy. (Rust+Flutter)
Stars: ✭ 440 (+216.55%)
Mutual labels:  web3
TheGame
The platform that MetaGame will be played on aka MetaOS - an open source framework for running decentralized societies. Currently featuring MetaSys, MyMeta Profiles, Dashboard, MetaMenu & Quests
Stars: ✭ 100 (-28.06%)
Mutual labels:  web3
pg-ipc
IPC over PostgreSQL LISTEN/NOTIFY/UNLISTEN exposed as an EventEmitter
Stars: ✭ 27 (-80.58%)
Mutual labels:  ipc
OpenLoginSdk
Pluggable auth infrastructure for Web3 wallets and dapps
Stars: ✭ 108 (-22.3%)
Mutual labels:  web3
Flutter Roadmap
This is a flutter roadmap and documentation repository. If anyone is interested you can join the party to help the community and make flutter great again.
Stars: ✭ 47 (-66.19%)
Mutual labels:  provider
launch
Matic network mainnet v1 launch
Stars: ✭ 56 (-59.71%)
Mutual labels:  web3
ether-swr
Ether-SWR is a React hook that fetches Ethereum data. It streamlines the chores to keep the internal state of the Decentralized App (DApp), batches the RPC calls to an Ethereum node and cache the responses
Stars: ✭ 125 (-10.07%)
Mutual labels:  web3
ipc-toolkit
A set of reusable functions to integrate IPC into an existing simulation.
Stars: ✭ 84 (-39.57%)
Mutual labels:  ipc
ipfs-blog
IPFS Blog & News
Stars: ✭ 31 (-77.7%)
Mutual labels:  web3
simppl
simppl::dbus - an easy-to-use C++ D-Bus wrapper
Stars: ✭ 51 (-63.31%)
Mutual labels:  ipc
ethereum-scripts
Common useful JavaScript snippets for geth
Stars: ✭ 33 (-76.26%)
Mutual labels:  web3
flutter app o2o
flutter高校食堂o2o预定服务,商业级应用,持续升级,完全开源。
Stars: ✭ 45 (-67.63%)
Mutual labels:  provider
socket
Dazzle Async Socket
Stars: ✭ 19 (-86.33%)
Mutual labels:  ipc
AndroidNetworkProgramming
Android网络编程实战总结,涉及HTTP、TCP、UDP常用协议。
Stars: ✭ 34 (-75.54%)
Mutual labels:  ipc
flutter read
A flutter project, 一款Flutter实战项目,已空安全适配,封装各种UI组件,网络组件以及使用peovider进行状态管理。
Stars: ✭ 51 (-63.31%)
Mutual labels:  provider
superhighway84
USENET-inspired, uncensorable, decentralized internet discussion system running on IPFS & OrbitDB
Stars: ✭ 437 (+214.39%)
Mutual labels:  web3
vortex-components
⚛️Vortex Components is a collection of React Components that helps developers build Ethereum Dapps powered by the Vortex Redux Store.
Stars: ✭ 14 (-89.93%)
Mutual labels:  web3
flutter database demo
🛠 Flutter 本地数据库存储 + 状态管理
Stars: ✭ 31 (-77.7%)
Mutual labels:  provider
coreipc
WCF-like service model API for communication over named pipes and TCP. .NET and node.js clients.
Stars: ✭ 22 (-84.17%)
Mutual labels:  ipc
glosseta
Glosseta is an open-source glossary meant to help people explore and learn the terminology behind web3
Stars: ✭ 23 (-83.45%)
Mutual labels:  web3

eth-provider


A Universal Ethereum Provider Client

Seamlessly connect to HTTP, WebSocket, IPC and Injected RPC transports in Node and the Browser!



Goals

  • Follows EIP 1193 Spec
  • Support all transport types (websocket, http, ipc & injected)
  • Attempt connection to an array of RPC endpoints until successful connection
  • Reconnect when connection is lost
  • Emit helpful status updates so apps can handle changes gracefully

Install

npm install eth-provider --save

Use

const provider = require('eth-provider')
const web3 = new Web3(provider())
  • By default, eth-provider will first try to discover providers injected by the environment, usually by a browser or extension
  • If eth-provider fails to find an injected provider it will attempt to connect to local providers running on the user's device like Frame, Geth or Parity
  • You can override these defaults by passing in your own RPC targets
const provider = require('eth-provider')
const web3 = new Web3(provider('wss://rinkeby.infura.io/ws/v3/${INFURA_ID}))
  • When passing in multiple RPC targets order them by priority
  • When eth-provider fails to connect to a target it will automatically attempt to connect to the next priority target
  • For example ['injected', 'wss://rinkeby.infura.io/ws/v3/${INFURA_ID}'] will first try to discover injected providers and if unsuccessful connect to the Infura endpoint
const provider = require('eth-provider')
const web3 = new Web3(provider(['injected', 'wss://rinkeby.infura.io/ws/v3/${INFURA_ID}']))
  • In Node and Electron you'll have access to IPC endpoints created by Geth or Parity that cannot be accessed by the Browser. You can connect to these by using the 'direct' preset, or by passing custom IPC paths
const provider = require('eth-provider')
const web3 = new Web3(provider('direct'))

Presets

  • injected - Discover providers injected by environment, usually by the browser or a browser extension
    • Browser
      • ['injected']
  • frame - Connect to Frame running on the user's device
    • Browser/Node/Electron
      • ['ws://127.0.0.1:1248', 'http://127.0.0.1:1248']
  • direct - Connect to local Ethereum nodes running on the user's device
    • Browser
      • ['ws://127.0.0.1:8546', 'http://127.0.0.1:8545']
    • Node/Electron
      • [/* Default IPC paths for platform */, 'ws://127.0.0.1:8546', 'http://127.0.0.1:8545']
  • infura - Connect to Mainnet Infura
    • Browser/Node/Electron
      • ['wss://mainnet.infura.io/ws/v3/${infuraId}', 'https://mainnet.infura.io/v3/${infuraId}']
  • alchemy - Connect to Mainnet Alchemy
    • Browser/Node/Electron
      • ['wss://eth-mainnet.ws.alchemyapi.io/v2/${alchemyId}', 'https://eth-mainnet.alchemyapi.io/v2/${alchemyId}']

View all possible presets here

If you do not pass any targets, eth-provider will use default targets ['injected', 'frame'] in the Browser and ['frame', 'direct'] in Node and Electron.

Options

When creating the provider you can also pass an options object

  • infuraId - Your projects Infura ID
  • alchemyId - Your projects Alchemy ID
  • origin - Used when connecting from outside of a browser env to declare the identity of your connection to interfaces like Frame (this currently doesn't work with HTTP connections)

provider('infura', { infuraId: '123abc' }) or provider({ origin: 'DappName', infuraId: '123abc' })

The origin setting will only be applied when a dapp is connecting to from outside of a browser env.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].