blockchain | truffle console 访问合约
今天用truffle console来测试昨天部署的合约。
一开始报错invalid opcode,查了一下还是创世区块配置的问题,这里贴上最新的配置文件:
{
"config":{
"chainId": 15,
"homesteadBlock": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000033",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gaslimit": "0x8000000",
"difficulty": "0x100",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {}
}
然后测试调用:
在调用set的时候本质上就是形成了一笔交易:
在默认情况下会使用eth.account[0]: