我正在 YouTube 上学习freeCodeCamp课程,在运行该程序时发现了一个错误。当我试图在 Ganache 中建立一个交易时。我在 Ganache 日志中看到也有活动。第一次发帖,请告诉我还应该提供哪些信息!
\n课程:Solidity、区块链和智能合约课程 \xe2\x80\x93 初学者到专家 Python 教程
\ntransaction = SimpleStorage.constructor().buildTransaction(\n {"chainId": chain_id, "from": my_address, "nonce": nonce}\n)\nRun Code Online (Sandbox Code Playgroud)\n终端返回的错误:
\ntransaction = SimpleStorage.constructor().buildTransaction(\n {"chainId": chain_id, "from": my_address, "nonce": nonce}\n)\nRun Code Online (Sandbox Code Playgroud)\n我使用的完整代码如下:
\nfrom solcx import compile_standard, install_solc\nimport json\nfrom web3 import Web3\n\nwith open("./SimpleStorage.sol", "r") as file:\n simple_storage_file = file.read()\n\n# Compile Our Solidity\nprint("Installing...")\ninstall_solc("0.6.0")\n\ncompiled_sol = compile_standard(\n {\n "language": "Solidity",\n "sources": {"SimpleStorage.sol": {"content": simple_storage_file}},\n "settings": {\n "outputSelection": {\n "*": {\n "*": [\n "abi",\n "metadata",\n "evm.bytecode",\n …Run Code Online (Sandbox Code Playgroud)