PatrickAlphaC / web3_py_simple_storage

47 stars 78 forks source link

Cannot build transaction with web3/Ganache, Error: Method eth_maxPriorityFeePerGas not supported #8

Closed shonendumm closed 2 years ago

shonendumm commented 2 years ago

Hi Patrick, thanks for the wonderful solidity tutorial.

I got stuck at https://youtu.be/M576WGiDBdQ?t=14423

the part where we're building a transaction with web3 and connecting to Ganache.

I tried to print(transaction) but got the errors below, specifically 'Method eth_maxPriorityFeePerGas not supported.'

By any chance, would you know how to resolve this?

Traceback (most recent call last): File "/Users/soohian/demos/web3_py_simple_storage/deploy.py", line 56, in <module> transaction = SimpleStorage.constructor().buildTransaction( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/eth_utils/decorators.py", line 18, in _wrapper return self.method(obj, *args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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__ File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/_utils/transactions.py", line 121, in fill_transaction_defaults default_val = default_getter(web3, transaction) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/_utils/transactions.py", line 71, in <lambda> web3.eth.max_priority_fee + (2 * web3.eth.get_block('latest')['baseFeePerGas']) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/eth.py", line 549, in max_priority_fee return self._max_priority_fee() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/module.py", line 57, in caller result = w3.manager.request_blocking(method_str, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/web3/manager.py", line 198, in request_blocking return self.formatted_response(response, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/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 (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/geth_api_double.js:70:16)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at GethDefaults.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/gethdefaults.js:15:12)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at SubscriptionSubprovider.FilterSubprovider.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/filters.js:89:7)\n at SubscriptionSubprovider.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/subscriptions.js:137:49)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at DelayedBlockFilter.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/delayedblockfilter.js:31:3)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at RequestFunnel.handleRequest (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/lib/subproviders/requestfunnel.js:32:12)\n at next (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:136:18)\n at Web3ProviderEngine._handleAsync (/Applications/Ganache.app/Contents/Resources/static/node/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:123:3)\n at Timeout._onTimeout (/Applications/Ganache.app/Contents/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'}}

plastikmind commented 2 years ago

wow, it's like we bumped into each other while walking on the road :) same mistake, at the same time. I need help too.

yiquncode commented 2 years ago

I got stuck in the same place. I guess the problem is caused by the new version of web3py.

fivetran-connorbrereton commented 2 years ago

Ran into this exact same issue. Thanks for posting

shonendumm commented 2 years ago

Someone has found the answer here: https://stackoverflow.com/questions/70051896/python-web3-and-ganache-error-method-eth-maxpriorityfeepergas-not-supported/70053558#70053558

Add "gasPrice": w3.eth.gas_price to

transaction = SimpleStorage.constructor().buildTransaction( { "gasPrice": w3.eth.gas_price, "chainId": chain_id, "from": my_address, "nonce": nonce, }

shonendumm commented 2 years ago

Suggestion to Patrick to consider adding this part 👆 , in case someone else encounters in future.

PatrickAlphaC commented 2 years ago

Thank you all so much for making this issue!

Thank you all so much for using the repos and being apart of the open sourced community 🙏

You are doing the course right coming here. Sometimes, things change and update. Knowing where/how to get the answer sometimes is more important that knowing the answer yourself.

Great work all!

qestar commented 2 years ago

good job!!!!