Ethereum 无法使用geth调用以太坊专用链中的约定

Ethereum 无法使用geth调用以太坊专用链中的约定,ethereum,invocation,contracts,Ethereum,Invocation,Contracts,我使用了一个迎宾合同并对其进行了编译,生成了如下的web3部署代码: var _greeting = "This is a contract" ; var ballot_sol_greeterContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"na

我使用了一个迎宾合同并对其进行了编译,生成了如下的web3部署代码:

var _greeting = "This is a contract" ;
var ballot_sol_greeterContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"payable":false,"type":"constructor"}]);
var ballot_sol_greeter = ballot_sol_greeterContract.new(
    _greeting,
    {
 from: web3.eth.accounts[0], 
 data: '0x6060604052341561000c57fe5b6040516103ac3803806103ac833981016040528080518201919050505b5b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b806001908051906020019061008292919061008a565b505b5061012f565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100cb57805160ff19168380011785556100f9565b828001600101855582156100f9579182015b828111156100f85782518255916020019190600101906100dd565b5b509050610106919061010a565b5090565b61012c91905b80821115610128576000816000905550600101610110565b5090565b90565b61026e8061013e6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806341c0e1b514610046578063cfae321714610058575bfe5b341561004e57fe5b6100566100f1565b005b341561006057fe5b610068610185565b60405180806020018281038252838181518152602001915080519060200190808383600083146100b7575b8051825260208311156100b757602082019150602081019050602083039250610093565b505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018257600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b61018d61022e565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102235780601f106101f857610100808354040283529160200191610223565b820191906000526020600020905b81548152906001019060200180831161020657829003601f168201915b505050505090505b90565b6020604051908101604052806000815250905600a165627a7a72305820c1f3ef4f75f67078057f269b87485e55352081a112b0c1d16d369e9ec82a99b30029', 
 gas: '4700000'
    }, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
     console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})
我创建了一个javascript文件,并尝试使用loadScript()加载该文件。它显示为true,然后我挖掘该文件,生成一个十六进制地址

然后我阻止了矿工,并使用greeter.greet()调用了合同。它显示

ReferenceError: 'greeter' is not defined
at <anonymous>:1:1
ReferenceError:未定义“问候者”
时间:1:1
执行时

eth.getCode(greeter.address)
ReferenceError: 'greeter' is not defined
at <anonymous>:1:13
eth.getCode(问候者地址)
ReferenceError:未定义“问候者”
时间:1:13
我使用了在线的solidity编译器 和GethV1.6.6。稳定版本

contract mortal {
  /* Define variable owner of the type address*/
  address owner;

  /* this function is executed at initialization and sets the owner of the     contract */
  function mortal() { owner = msg.sender; }

  /* Function to recover the funds on the contract */
 function kill() { if (msg.sender == owner) suicide(owner); }
}

contract greeter is mortal {
 /* define variable greeting of the type string */
 string greeting;

 /* this runs when the contract is executed */
 function greeter(string _greeting) public {
    greeting = _greeting;
 }

 /* main function */
 function greet() constant returns (string) {
    return greeting;
  }
 }
此外,在部署代码时:

 >loadScript("firstContract.js")
  INFO [06-27|19:48:01] Submitted contract creation             
 fullhash=0x1037088a27d9cacf9ced417381489ba58658c09e4377ec1f66a9bc24c1f29269 
 contract=0x2c7e7791dfe505c4f3d456d762990558d4cbe171
 null [object Object]
 true

您还没有显示定义了
greeter
的任何代码。显示此代码。代码如下所示。此外,我还试图找出错误所在,因此我意识到,在部署自身时,它没有获得迎宾员的地址,但它说的是真的我在上面提到的eth.getCode(greeter.address)应该是eth.getCode(ballot\u sol\u greeter.address),但问题仍然是在加载脚本时显示null[object][object](即下文所述)