/* * NB: since truffle-hdwallet-provider 0.0.5 you must wrap HDWallet providers in a * function when declaring them. Failure to do so will cause commands to hang. ex: * ``` * mainnet: { * provider: function() { * return new HDWalletProvider(mnemonic, 'https://mainnet.infura.io/') * }, * network_id: '1', * gas: 4500000, * gasPrice: 10000000000, * }, */ const { readFileSync } = require('fs') const LoomTruffleProvider = require('loom-truffle-provider') const env = 'local' // 'ubuntu' or 'centos' for remove disposition, 'local' for local test let ipAddr let keyPath if (env === 'local') { ipAddr = '127.0.0.1' keyPath = './private_key' } else if (env === 'ubuntu') { ipAddr = '10.108.39.133' // Lab keyPath = './private_key' } else if (env === 'centos') { // Problems remain ipAddr = '111.230.181.241' // Tencent cloud keyPath = './privateKey' } const chainId = 'default' const writeUrl = `http://${ipAddr}:46658/rpc` const readUrl = `http://${ipAddr}:46658/query` // ./privateKey file contains a base64 encoded key generated by the command: // loom genkey -a publicKey -k privateKey const privateKey = readFileSync(keyPath, 'utf-8') const loomTruffleProvider = new LoomTruffleProvider(chainId, writeUrl, readUrl, privateKey) // Create 10 extra accounts, useful for tests loomTruffleProvider.createExtraAccounts(10) module.exports = { // See // to customize your Truffle configuration! migrations_directory: './migrations', networks: { development: { // For windows only host: 'localhost', port: 7545, network_id: '*', // Match any network id gasPrice: 1, gas: 8000000, }, loom: { host: ipAddr, provider: loomTruffleProvider, network_id: '*', }, }, }