我正试着效仿这个例子:https://github.com/ethereum/pyethapp/wiki/The_控制台
然而,在我应该编译代码的时候,我得到了一个错误:
In [34]: print c
contract NameReg{
event AddressRegistered(bytes32 indexed name, address indexed account);
mapping(address => bytes32) toName;
function register(bytes32 name){
toName[msg.sender] = name;
AddressRegistered(name, msg.sender);
}
function resolve(address addr) constant returns(bytes32 name){
return toName[addr];
}
}
In [35]: solidity.compile(c)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-35-7d9906629614> in <module>()
----> 1 solidity.compile(c)
/home/work/Software/ethereum/pyethapp/.venv/local/lib/python2.7/site-packages/ethereum/_solidity.pyc in compile(cls, code, path, libraries, contract_name)
51 sorted_contracts[idx][1]['bin'] = sorted_contracts[idx][1]['bin'].replace(
52 "__{}{}".format(lib_name, "_" * (38 - len(lib_name))), lib_address)
---> 53 return sorted_contracts[idx][1]['bin'].decode('hex')
54
55 @classmethod
IndexError: list index out of range我知道在“编译”调用中缺少一个论点,但哪一个呢?我应该提供什么课程?
发布于 2018-05-22 15:11:50
您需要导入稳固版本。例子:
pragma solidity ^0.4.18;https://ethereum.stackexchange.com/questions/5818
复制相似问题