智能合約部署問題與解決方案
部署好智能合約以後不管輸入什麼參數,返回的都是零值
可以參考以下鏈接:
- https://ethereum.stackexchange.com/questions/75962/call-smart-contract-function-in-geth
- https://ethereum.stackexchange.com/questions/67794/how-to-setup-constantinople-fork-for-private-ethereum-chain
- https://ethereum.stackexchange.com/questions/78616/it-possible-to-hard-fork-a-private-network-without-resyncing-chain-from-scratch
需要設置分叉,即在gensis.json文件中的config中補充:
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"ethash": {}
這邊貼出我的完整的創世區塊設置
{
"config": {
"chainId": 20191111,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"ethash": {}
},
"alloc" : {},
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x20000",
"extraData" : "",
"gasLimit" : "0xffffffff",
"nonce" : "0x0000000000000042",
"mixhash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
"timestamp" : "0x00"
}