Last active
July 14, 2019 03:38
-
-
Save tomconte/8ef602bf38c4dd11a6b47b7e1114e30c to your computer and use it in GitHub Desktop.
Example Truffle 3.0 configuration file to allow deploying contracts to an Azure "Bletchley" Ethereum consortium network. Based on the Truffle docs for Infura (http://truffleframework.com/tutorials/using-infura-custom-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
var bip39 = require("bip39"); | |
var ethwallet = require('ethereumjs-wallet'); | |
var ProviderEngine = require("web3-provider-engine"); | |
var WalletSubprovider = require('web3-provider-engine/subproviders/wallet.js'); | |
var Web3Subprovider = require("web3-provider-engine/subproviders/web3.js"); | |
var Web3 = require("web3"); | |
// Insert raw hex private key here, e.g. using MyEtherWallet | |
var wallet = ethwallet.fromPrivateKey(Buffer.from('abcdef', 'hex')); | |
var address = "0x" + wallet.getAddress().toString("hex"); | |
var providerUrl = "http://tcolm3ew4.westeurope.cloudapp.azure.com:8545"; | |
var engine = new ProviderEngine(); | |
engine.addProvider(new WalletSubprovider(wallet, {})); | |
engine.addProvider(new Web3Subprovider(new Web3.providers.HttpProvider(providerUrl))); | |
engine.start(); // Required by the provider engine. | |
module.exports = { | |
networks: { | |
development: { | |
host: "localhost", | |
port: 8545, | |
network_id: "*" // Match any network id | |
}, | |
"bletchley": { | |
network_id: 10101010, // Use the ID provided at creation time | |
provider: engine, // Use our custom provider | |
from: address // Use the address we derived | |
} | |
}, | |
rpc: { | |
host: "localhost", | |
port: 8545 | |
} | |
}; |
Same question as @cbruguera
I had the same issue so I switched to truffle-hdwallet-provider
. Works smoothly right out of the box.
https://github.com/trufflesuite/truffle-hdwallet-provider
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I leave the
engine.start()
line uncommented, truffle "hangs" even when making a compile... Any ideas?