Skip to content

Instantly share code, notes, and snippets.

@cicorias
Forked from tomconte/truffle-config.js
Created March 12, 2017 17:06
Show Gist options
  • Save cicorias/a6a766e4128def0bc45e8f083ce4d05a to your computer and use it in GitHub Desktop.
Save cicorias/a6a766e4128def0bc45e8f083ce4d05a 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).
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('324a58ceac32c9a5a465a57a87600c086df72aa4ae0c6beb062436a2b6c0a2a6', '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
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment