fix rpccorsdomain; deployment to livenet and testnet

This commit is contained in:
Iuri Matias 2016-09-25 20:51:00 -04:00
parent 8190c785f4
commit d21f385fc0
6 changed files with 42 additions and 13 deletions

View File

@ -1,16 +1,26 @@
{
"0xb6cfeab83614da04c03db0fb8a6787a45d0be8d576fcc6f8f457a5a816d22ab3": {
"name": "development",
"networkId": "",
"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3": {
"name": "livenet",
"contracts": {
"5a52b16abb7dfccfc675550d0daba1683a3cf7e80fb5f0e199301f7dd57237fb": {
"address": "0x9b7d9cfed1dcc25ffa10cabf09ed69107634bcc7",
"address": "0x58a580ca43e04e82716c528bc134144042d99ff6",
"name": "SimpleStorage"
},
"708fa6b699f419627ab3c4c2d9c82f8f1a6fab03c122d0a9ee55d2d0d0ad1e4b": {
"address": "0x3134e7b4b2bf08f50b299ad35a2271c6f5ebed5b",
"address": "0x717ceee627be5e18b3cd0386d104281688f91cef",
"name": "token"
}
}
},
"0xeb9f1658ba4415557d3952c22cb6aadd416c6d803a47f7ab6c21acb7e758483c": {
"name": "livenet",
"contracts": {
"5a52b16abb7dfccfc675550d0daba1683a3cf7e80fb5f0e199301f7dd57237fb": {
"name": "SimpleStorage"
},
"708fa6b699f419627ab3c4c2d9c82f8f1a6fab03c122d0a9ee55d2d0d0ad1e4b": {
"name": "token"
}
}
}
}

View File

@ -7,17 +7,24 @@
"nodiscover": true,
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/development/password"
}
},
"testnet": {
"networkType": "testnet",
"rpcHost": "localhost",
"rpcPort": 8545,
"networkType": "testnet"
"rpcPort": 8545
},
"livenet": {
"networkType": "livenet"
"networkType": "livenet",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/production/password"
}
},
"privatenet": {
"networkType": "custom",

View File

@ -13,6 +13,7 @@ var Blockchain = function(blockchainConfig, Client) {
mineWhenNeeded: this.blockchainConfig.mineWhenNeeded || false,
rpcHost: this.blockchainConfig.rpcHost || 'localhost',
rpcPort: this.blockchainConfig.rpcPort || 8545,
rpcCorsDomain: this.blockchainConfig.rpcCorsDomain || false,
networkId: this.blockchainConfig.networkId || 12301,
port: this.blockchainConfig.port || 30303,
nodiscover: this.blockchainConfig.nodiscover || false,

View File

@ -40,8 +40,14 @@ Deploy.prototype.deployContract = function(contract, params, callback) {
var contractParams = (params || contract.args).slice();
console.log("using address" + this.web3.eth.accounts[0]);
// TODO: probably needs to be defaultAccoun
// TODO: it wouldn't necessary be the first address
// idea: use defined blockchain address or first address
contractParams.push({
from: this.web3.eth.coinbase,
//from: this.web3.eth.coinbase,
from: this.web3.eth.accounts[0],
data: contract.code,
gas: contract.gas,
gasPrice: contract.gasPrice

View File

@ -82,7 +82,7 @@ GethCommands.prototype.mainCommand = function(address) {
cmd += "--olympic ";
}
if (config.networkType !== 'custom') {
if (config.networkType === 'custom') {
cmd += "--networkid " + config.networkId + " ";
}
@ -94,9 +94,12 @@ GethCommands.prototype.mainCommand = function(address) {
cmd += "--rpc ";
cmd += "--rpcport " + config.rpcPort + " ";
cmd += "--rpcaddr " + config.rpcHost + " ";
//cmd += "--rpccorsdomain=\"" + "localhost" + "\" ";
cmd += "--rpccorsdomain=\"" + "*" + "\" ";
//cmd += "--rpccorsdomain=\"" + config.rpcWhitelist + "\" ";
if (config.rpcCorsDomain) {
// TODO: show gigantic warning when cors is set to *
cmd += "--rpccorsdomain=\"" + config.rpcCorsDomain + "\" ";
} else {
// TODO: show warning when cors is not set
}
//"nodiscover": true,

View File

@ -98,6 +98,7 @@ var Embark = {
self.logger.logFunction = Embark.monitor.logEntry;
self.logger.contractsState = Embark.monitor.setContracts;
self.logger.availableServices = Embark.monitor.availableServices;
// TODO: do this after monitor is rendered
callback();
},
function monitorServices(callback) {
@ -200,6 +201,7 @@ var Embark = {
//TODO: figure out where to put this since the web3 can be passed along if needed
// perhaps it should go into the deploy object itself
// TODO: should come from the config object
var web3 = new Web3();
var web3Endpoint = 'http://' + self.config.blockchainConfig.rpcHost + ':' + self.config.blockchainConfig.rpcPort;
web3.setProvider(new web3.providers.HttpProvider(web3Endpoint));