jklepatch / eattheblocks

Source code for Eat The Blocks, a screencast for Ethereum Dapp Developers

Home Page:https://eattheblocks.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error when tried to connect to infura blockchain LESSON 12

anthonylauw opened this issue · comments

Hi i encountered the below issue, please advise how to solve this

Error: connection not open on send()
at Object.ConnectionError (C:\Users\anthony\Downloads\Flashloan\node_modules\web3-core-helpers\lib\errors.js:66:23)
at Object.ConnectionNotOpenError (C:\Users\anthony\Downloads\Flashloan\node_modules\web3-core-helpers\lib\errors.js:49:21)
at C:\Users\anthony\Downloads\Flashloan\node_modules\web3-providers-ws\lib\index.js:155:37
at Map.forEach ()
at WebsocketProvider._onClose (C:\Users\anthony\Downloads\Flashloan\node_modules\web3-providers-ws\lib\index.js:154:27)
at W3CWebSocket._dispatchEvent [as dispatchEvent] (C:\Users\anthony\Downloads\Flashloan\node_modules\yaeti\lib\EventTarget.js:115:12)
at W3CWebSocket.onConnectFailed (C:\Users\anthony\Downloads\Flashloan\node_modules\websocket\lib\W3CWebSocket.js:219:14)
at WebSocketClient. (C:\Users\anthony\Downloads\Flashloan\node_modules\websocket\lib\W3CWebSocket.js:59:25)
at WebSocketClient.emit (node:events:390:28)
at WebSocketClient.failHandshake (C:\Users\anthony\Downloads\Flashloan\node_modules\websocket\lib\WebSocketClient.js:339:10)
at ClientRequest. (C:\Users\anthony\Downloads\Flashloan\node_modules\websocket\lib\WebSocketClient.js:278:18)
at ClientRequest.emit (node:events:390:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:623:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
at TLSSocket.socketOnData (node:_http_client:487:22)
at TLSSocket.emit (node:events:390:28) {
code: 1006,
reason: 'connection failed'
}

First install @hdwallet module and store your mnemonic of wallet in env file also install env module and then create your network like i am creating ropsten here
:=
ropsten: {
provider: () => new HDWalletProvider(Process.env.KEY, https://ropsten.infura.io/v3/${Process.env.PROJECTID}),
network_id: 3, // Ropsten's id
gas: 5500000, // Ropsten has a lower block limit than mainnet
confirmations: 2, // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
},

then Run command npx truffle network --ropsten