Created
April 11, 2019 13:49
-
-
Save schadokar/2ed83ae1f7a45cff6da974d989f0abcd to your computer and use it in GitHub Desktop.
web3 provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// web3.js | |
const fs = require("fs"); | |
const Web3 = require("web3"); | |
const web3Network = "ganache" | |
// creating a web3 instance on ganache-cli network | |
// Here the url is http://ganache:8545 | |
// this ganache is the name of the container in which ganache-cli is running | |
const web3 = new Web3(new Web3.providers.HttpProvider("http://ganache:8545")) | |
// local ganache-cli setup | |
const eventProvider = new Web3.providers.WebsocketProvider( | |
"ws://ganache:8545" | |
); | |
web3.setProvider(eventProvider); | |
module.exports = { | |
web3, | |
web3Network | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment