Created
February 9, 2019 13:34
-
-
Save tssandor/814b9b2809239194f4dc431288c6ca9c to your computer and use it in GitHub Desktop.
Fixed truffle.js to get past dry run
This file contains hidden or 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
| // ************* | |
| // This Gist fixes the truffle.js in the tutorial on this link: | |
| // https://medium.com/coinmonks/create-a-sports-betting-dapp-on-the-ethereum-blockchain-part-1-1f69f908b939 | |
| // -- | |
| // The code in the Medium article stops at dry run and never actually deploys the contract to Ropsten. | |
| // This is almost certainly because of a change in how Truffle works. | |
| var WalletProvider = require("truffle-wallet-provider"); | |
| // ***CHANGE -> using HDWalletProvider | |
| var HDWalletProvider = require("truffle-hdwallet-provider"); | |
| // ***CHANGE -> we store the private key as a string, not as a Buffer | |
| const MNEMONIC='YOUR-PRIVATE-KEY'; | |
| const Wallet = require('ethereumjs-wallet'); | |
| // ***CHANGE -> the following 3 lines had to be commented out | |
| //var ropstenPrivateKey = new Buffer("YOUR-PRIVATE-KEY","hex"); | |
| //var ropstenWallet = Wallet.fromPrivateKey(ropstenPrivateKey); | |
| //var ropstenProvider = new WalletProvider(ropstenWallet, "https://ropsten.infura.io/v3/INFURA-KEY"); | |
| module.exports = { | |
| // See <http://truffleframework.com/docs/advanced/configuration> | |
| // to customize your Truffle configuration! | |
| networks: { | |
| development: { | |
| host: "127.0.0.1", | |
| port: 8545, | |
| network_id: "*", // Match any network id | |
| }, | |
| ropsten: { | |
| //provider: ropstenProvider, | |
| // ***CHANGE -> using HDWalletProvider, note that we don't have /v3/ in the Infura link | |
| provider: function() { | |
| return new HDWalletProvider(MNEMONIC, "https://ropsten.infura.io/INFURA-KEY") | |
| }, | |
| // ***CHANGE -> lowered gas | |
| gas: 4000000, | |
| network_id: 3 | |
| } | |
| } | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment