区块链基础 - 遇到的问题
1. 以太坊部署完智能合约后,使用balanceOf函数会出现如下错误。
transact to ERC20Token.MyToken errored: Error: Returned error: invalid opcode: SHR
这种问题是创世区块引起的,可以使用如下genesis.json创建创世区块(相关链接:https://blog.ethereum.org/2019/02/22/ethereum-constantinople-st-petersburg-upgrade-announcement/)
{ "config": { "chainId": 11, "homesteadBlock": 0, "eip150Block": 0, "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", "eip155Block": 0, "eip158Block": 0, "byzantiumBlock": 0, "constantinopleBlock": 0, "petersburgBlock": 0, "ethash": {} }, "nonce": "0x0", "timestamp": "0x5d5cdc87", "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000", "gasLimit": "0x47b760", "difficulty": "0x80000", "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x0000000000000000000000000000000000000000", "alloc": { "0000000000000000000000000000000000000000": { "balance": "0x1" } }, "number": "0x0", "gasUsed": "0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" }
本博客内容都是博主试验通过的方案与方法.
如需交流,请发邮件至qjyyn#qq.com