繁体   English   中英

你好。 我无法在 ganache 上部署合同。 有人可以帮忙吗? 我使用带有 Solidity abi 和字节码的 python

[英]Hello. Im having trouble deploying a contract on ganache. Can someone please assist? Im using python with a Solidity abi and bytecode

这是代码截图的链接,因为我无法弄清楚格式。 https://i.imgur.com/yiHFkon.png


和错误的镜头:

 (venv) PS C:\Users\usuario\pyblock> py Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from deploy import * >>> deploy_contract(7,10,os.environ['ADDRESS_1'],os.environ['PRIVATE_KEY_1']) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\usuario\pyblock\deploy.py", line 27, in deploy_contract deployment = guess_number.constructor(secret_number).buildTransaction(transaction_body) File "C:\Users\usuario\pyblock\venv\lib\site-packages\eth_utils\decorators.py", line 18, in _wrapper return self.method(obj, *args, **kwargs) File "C:\Users\usuario\pyblock\venv\lib\site-packages\web3\contract.py", line 684, in buildTransaction return fill_transaction_defaults(self.web3, built_transaction) File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__ return self.func(*args, **kwargs) File "C:\Users\usuario\pyblock\venv\lib\site-packages\web3\_utils\transactions.py", line 121, in fill_transaction_defaults default_val = default_getter(web3, transaction) File "C:\Users\usuario\pyblock\venv\lib\site-packages\web3\_utils\transactions.py", line 71, in <lambda> web3.eth.max_priority_fee + (2 * web3.eth.get_block('latest')['baseFeePerGas']) File "C:\Users\usuario\pyblock\venv\lib\site-packages\web3\eth.py", line 549, in max_priority_fee return self._max_priority_fee() File "C:\Users\usuario\pyblock\venv\lib\site-packages\web3\module.py", line 57, in caller result = w3.manager.request_blocking(method_str, File "C:\Users\usuario\pyblock\venv\lib\site-packages\web3\manager.py", line 198, in request_blocking return self.formatted_response(response, File "C:\Users\usuario\pyblock\venv\lib\site-packages\web3\manager.py", line 171, in formatted_response raise ValueError(response["error"]) ValueError: {'message': 'Method eth_maxPriorityFeePerGas not supported.', 'code': -32000, 'data': {'stack': 'Error: Method eth_maxPriorityFeePerGas not supported.\n at GethApiDouble.handleRequest (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\lib\\subproviders\\geth_api_double.js:70:16)\n at next (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\index.js:136:18)\n at GethDefaults.handleRequest (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\lib\\subproviders\\gethdefaults.js:15:12)\n at next (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\index.js:136:18)\n at SubscriptionSubprovider.FilterSubprovider.handleRequest (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\subproviders\\filters.js:89:7)\n at SubscriptionSubprovider.handleRequest (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\subproviders\\subscriptions.js:137:49)\n at next (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\index.js:136:18)\n at DelayedBlockFilter.handleRequest (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\lib\\subproviders\\delayedblockfilter.js:31:3)\n at next (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\index.js:136:18)\n at RequestFunnel.handleRequest (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\lib\\subproviders\\requestfunnel.js:32:12)\n at next (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\index.js:136:18)\n at Web3ProviderEngine._handleAsync (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\index.js:123:3)\n at Timeout._onTimeout (C:\\Program Files\\WindowsApps\\GanacheUI_2.5.4.0_x64__5dg5pnz03psnj\\app\\resources\\static\\node\\node_modules\\ganache-core\\node_modules\\web3-provider-engine\\index.js:107:12)\n at listOnTimeout (internal/timers.js:531:17)\n at processTimers (internal/timers.js:475:7)', 'name': 'Error'}}

在您的 transaction_body 中,您需要像这样添加 gasPrice:

"gasPrice": web3_connection.eth.gas_price

这是由于 EIP1559 更改,以及 web3.py 更新的更改。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM