以太坊欢迎教程:合同返回“null [object Object]”

时间:2016-05-25 20:04:17

标签: ethereum

尝试按照迎宾教程,虽然我已经回避了一些问题(无法在本地安装solC),但这个让我陷入困境。

我已经在网上编制了可靠性https://ethereum.github.io/browser-solidity/#version=soljson-latest.js

结果是右边两个不同的部分,一个用于'greeter',一个用于'mortal'。

我在本地启动geth控制台并使用“personal.unlockAccount”解锁我的帐户。在粘贴了欢迎合同的“Web3部署”部分的文本后,我得到了回复 null [object Object] 从geth控制台和控制台冻结,不会出现另一个提示。这是粘贴:

var _greeting = "yellow";
var greeterContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"type":"constructor"}]);
var greeter = greeterContract.new(
_greeting,
{
 from: web3.eth.accounts[0], 
 data: '606060405260405161023e38038061023e8339810160405280510160008054600160a060020a031916331790558060016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10609f57805160ff19168380011785555b50608e9291505b8082111560cc57600081558301607d565b50505061016e806100d06000396000f35b828001600101855582156076579182015b82811115607657825182600050559160200191906001019060b0565b509056606060405260e060020a600035046341c0e1b58114610026578063cfae321714610068575b005b6100246000543373ffffffffffffffffffffffffffffffffffffffff908116911614156101375760005473ffffffffffffffffffffffffffffffffffffffff16ff5b6100c9600060609081526001805460a06020601f6002600019610100868816150201909416939093049283018190040281016040526080828152929190828280156101645780601f1061013957610100808354040283529160200191610164565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156101295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b565b820191906000526020600020905b81548152906001019060200180831161014757829003601f168201915b505050505090509056', 
gas: 3000000
}, function(e, contract){
console.log(e, contract);
if (typeof contract.address != 'undefined') {
     console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})

任何人都有线索,因为我肯定不会

1 个答案:

答案 0 :(得分:2)

null [object Object]一定不会出现任何问题。

开始挖掘,miner.start(),并等待合同挖掘地址的回归,获取地址取决于CPU的速度。等等。

尝试使用比greeter更简单的示例 查看此链接,可能有用

http://billmarino2.github.io/general/2015/12/09/JURIX-2015-setting-up-an-ethereum-testnet.html