current position:Home>How to set up the latest provider

How to set up the latest provider

2022-02-03 23:28:18 Q & A of Denglian community

I follow the online way :if (typeof web3 !== 'undefined') {web3 = new Web3(web3.currentProvider);alert("ok")} else {web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));alert(" Failure ")}

My Google browser has built-in matemask, But I won't go web3 = new Web3(web3.currentProvider);alert("ok") Finally open ganache, Will go Web3.providers.HttpProvider("http://localhost:7545"));alert(" Failure "), Want to ask , Just use Ethereum to test the network , This provider How to write






Other answers 1:

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032328161023.html

Random recommended