2017-11-16 19 views
2
내가 this tutorial를 fallowing ICO 기반 데모 에테 리움을 설정하기 위해 노력했습니다

를 통해 Rinkeby 또는 Ropsten에 스마트 계약을 배포 할 수 없습니다,하지만 난 Ropsten 또는 Rinkeby에 계약을 배포 할 때마다 적외선이 오류와 함께 실패합니다는 트러플

Running migration: 2_deploy_contracts.js 
    Deploying SuperHeroTokenThreeCrowdsale... 
    ... 0x9d0da17f00192993720639abceecc2b33c5fbb9a29dd43fa6e1abd0ce6aecc5d 
Error encountered, bailing. Network state unknown. Review successful transactions manually. 
Error: The contract code couldn't be stored, please check your gas amount. 
    at Object.callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:314870:46) 
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:35060:25 
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:316808:9 
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:164746:11 
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:294942:9 
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:296367:13) 
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:164934:18) 
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:165224:12) 
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:165379:12) 
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:165339:24) 
  • 시스템 : 우분투 16.04
  • 트러플 : V4.0.0 - beta.2
  • Geth : 1.7.2 안정
  • OpenZeppelyn 견고 1.3.0

truffle.js :

module.exports = { 
    networks: { 
    development: { 
     host: "localhost", 
     port: 8545, 
     gas: 4700000, 
     from: '0x24182550B8630629501AC11f5568dbb7EE18dBd2', 
     network_id: "*" // Match any network id 
    }, 
    } 
}; 

또한 나는 내가 에테르 내 Rinkeby 계정에서의 가지고 말해야한다. 또 다른 메모 - TestRpc에 배포하면 잘 작동하지만 사용자 토큰을 구입할 수 있습니다. 모두 잘 작동합니다. 가스량을 조정하려고했지만 아무것도 바뀌지 않았습니다.

어떤 아이디어가 문제 일 수 있습니까?

+0

geth가 완전히 동기화되지 않았거나 원격 포트가 열려 있지 않을 수 있습니다. – webjunkie

+0

나는이 명령으로 Geth를 시작한다 :'geth --rinkeby --rpc --rpcapi eth, net, web3, personal' –

답변

1

계약서가 가스 한도에 비해 너무 클 수 있습니다. gasLimit을 창세기에 0x60000000000000과 같이 매우 높은 값으로 설정하십시오. 이 방법으로 가스를 증가시킬 수 있습니다 : truffle.js에서 6000000. 이것은 계약을 전개하기에 충분해야합니다.

0

ropsten 네트워크의 truffle.js 파일에있는 동일한 문제 세트 가스 : 4700036도 마주하고 있습니다. 효과가있을 수 있습니다.

0

나는 또한 같은 문제에 직면했고 여기에 내가이 오류를 해결하기 위해 무엇을했는지가 나와있다.

zeppelin-solidity를 사용하는 스마트 계약을 전개 할 때 가장 먼저 유의해야 할 것은 튜토리얼에서 살펴본 바와 같이 높은 가스 가치를 사용한다는 것입니다. testrpc에 계약을 전개 할 수 있었지만 testnet (rinkeby 및 ropsten)에 배치 할 수 없었습니다. testrpc 콘솔을 모니터링 할 때, 계약서에는 5200000 개의 가스가 사용되었습니다. 어디 ropsten에 대한 블록 제한 (https://ropsten.infura.io) 4700000입니다. 따라서 내 계약은 거기에 배포 점점 아니었고 그것은 동일한 오류를주고 있었다. truffle.js 파일에서 가스량을 늘리면 "블록 가스 한도 초과"오류가 발생합니다.

그래서 나는 truffle.js 파일의 다음 구성으로 Rinkeby 네트워크에 계약을 전개하기로 결정했습니다. npm install을 사용하여 npm 종속성을 설치하십시오.

require('dotenv').config(); 
const Web3 = require("web3"); 
const web3 = new Web3(); 
const WalletProvider = require("truffle-wallet-provider"); 
const Wallet = require('ethereumjs-wallet'); 

var rinkebyPrivateKey = new Buffer(process.env["RINKEBY_PRIVATE_KEY"], "hex") 
var rinkebyWallet = Wallet.fromPrivateKey(rinkebyPrivateKey); 
var rinkebyProvider = new WalletProvider(rinkebyWallet, "https://rinkeby.infura.io/"); 

module.exports = { 
    networks: { 
    development: { 
     host: "localhost", 
     port: 8545, 
     gas: 6700000, 
     from: "0x2abdf05db2c9632ab240ee59963816f09e6d3e5a", 
     network_id: "*" // Match any network id 
    }, 
    rinkeby: { 
     provider: rinkebyProvider, 
     gas: 6700000, 
     gasPrice: web3.toWei("20", "gwei"), 
     network_id: "2", 
    } 
    }, 
    solc: { 
    optimizer: { 
     enabled: true, 
     runs: 200 
    } 
    } 
}; 

이 문제를 해결하는 데 도움이되기를 바랍니다. 어떤 경우라도 알려주세요.

1

코드에 오류가있는 것 같습니다. 이 메시지는 오해의 소지가 있습니다. 2_deploy_contracts.js에 rinkeby에 배포 할 수있는 계약을 startTimeendTime을 변경 한 후 truffle.js

의 가스 값을 변경할 필요가 없습니다.

const IcoMyCoin = artifacts.require("./MyCoinCrowdsale.sol"); 
const duration = { 
    seconds: function(val) { return val}, 
    minutes: function(val) { return val * this.seconds(60) }, 
    hours: function(val) { return val * this.minutes(60) }, 
    days: function(val) { return val * this.hours(24) }, 
    weeks: function(val) { return val * this.days(7) }, 
    years: function(val) { return val * this.days(365)} 
}; 

module.exports = function(deployer, network, accounts) { 
    const startTime = web3.eth.getBlock('latest').timestamp + duration.minutes(1); 
    const endTime = startTime + duration.minutes(30); 
    const rate = new web3.BigNumber(1000); 
    const wallet = '<< YOUR WALLET ADDRESS>>'; 

    deployer.deploy(IcoMyCoin, startTime, endTime, rate, wallet) 
};