How to use Infura.io with Web3.js 1.0

Hideyoshi Moriya
1 min readAug 23, 2018

--

  • HTTP provider is deprecated in Web3.js 1.0.
  • Websocket provider needs to be used instead of HTTP provider.
  • Infura HTTP provider URL: https://mainnet.infura.io
  • Infura Websocket URL: wss://mainnet.infura.io/ws

In Web3.js 1.0, Web3 needs to be initialized as below.

var web3 = new Web3('wss://mainnet.infura.io/ws');

Support

If you find this article is helpful, it would be greatly appreciated if you could tip Ether to the address below. Thank you!

0x0089d53F703f7E0843953D48133f74cE247184c2

--

--