创建以太坊合约(去以太坊)

nor*_*ray 6 ethereum

尝试按照以太坊的wiki示例创建基本合同:https: //github.com/ethereum/go-ethereum/wiki/Contracts-and-Transactions

一切似乎都有效,直到我下到最后一行:

source = "contract test { function multiply(uint a) returns(uint d) { return a * 7; } }"
contract = eth.compile.solidity(source).test
primaryAddress = eth.accounts[0]

# **Problems start here **
MyContract = eth.contract(abi);
contact = MyContract.new(arg1, arg2, ...,{from: primaryAddress, data: evmCode})
Run Code Online (Sandbox Code Playgroud)

eth.contract方法的"abi"参数是什么?另外,我会在"evmCode"参数中加入什么?在这个特定的例子中,似乎我会为"arg1"输入一个整数,但不确定完整的例子应该是什么样子.

Vis*_*akh 10

ABI是您的合同公开的接口."evmCode"是您的合同的以太坊字节代码.

要解决您的问题,请访问https://chriseth.github.io/browser-solidity/并插入您的Solidity in.右侧的字节码字段将为您提供"evmCode"的值,Interface将为您提供ABI .

您还可以从"Web3部署"复制代码段并将其粘贴到代码中以部署合同.