首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Web3 Python不工作:内部气体太低

Web3 Python不工作:内部气体太低
EN

Stack Overflow用户
提问于 2022-03-24 01:48:42
回答 1查看 839关注 0票数 0

为什么煤气费不起作用?如果我不收煤气费,交易就成功了。但是,如果我加上煤气费,交易就会失败,并返回错误:

{“代码”:-32000,“消息”:“内部气体太低”}

代码语言:javascript
复制
web3matic = Web3(Web3.HTTPProvider(matic))

                    nonce = web3matic.eth.get_transaction_count(walletAddress)
                    result = contract.functions.buy(item, int(price)).buildTransaction({
                        'from': walletAddress,
                        'nonce': nonce,
                        'gas': 21000,
                        'gasPrice': web3matic.toWei(700, 'gwei'),
                    })
                    print(result)
EN

回答 1

Stack Overflow用户

发布于 2022-05-11 04:02:33

尝试将gas设置为3000000并使用w3.eth.gasPrice for gasPrice

背景:在2021年10月,多边形将1千兆吨的最低天然气价格提高到了30英镑。

代码语言:javascript
复制
web3matic = Web3(Web3.HTTPProvider(matic))

                    nonce = web3matic.eth.get_transaction_count(walletAddress)
                    result = contract.functions.buy(item, int(price)).buildTransaction({
                        'from': walletAddress,
                        'nonce': nonce,
                        'gas': 3000000,
                        'gasPrice': web3matic.eth.gasPrice,
                    })
                    print(result)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71596147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档