python - BSC链上使用合约转账,{'code': -32000, 'message': 'transaction type not supported'}
问题描述
def transfer():
web3_server = Web3(Web3.HTTPProvider("https://bsc-dataseed1.binance.org"))
nonce = web3_server.eth.get_transaction_count("address")
transaction = {
'to': 'address',
'value': 1000000000,
'gas': 2000000,
'maxFeePerGas': 2000000000,
'maxPriorityFeePerGas': 1000000000,
'nonce': nonce,
'chainId': 56,
'type': '0x2',
}
signed_txn = web3_server.eth.account.sign_transaction(transaction, 'my private key')
// Send the transaction here
web3_server.eth.send_raw_transaction(signed_txn.rawTransaction)
// Error returned after sending transaction
ValueError: {'code': -32000, 'message': 'transaction type not supported'}
retval = web3_server.toHex(web3_server.keccak(signed_txn.rawTransaction))
print(retval)
我想用Web3py调用带有本地密钥的合约来签署交易,在HECO上可以正常使用。但它在 BSC 上失败了
解决方案
推荐阅读
- angular - 具有 ngx-translate 依赖项的 Angular 6 单元测试
- profiling - Class::DBI - 它会加载所有表吗?
- delphi - FireDAC“无法完成对主机的网络请求”
- wxwidgets - wx.Grid 和 ScrolledWindows
- javascript - 如何使用 react-swipe-card 在 React 中构建可堆叠的卡片?
- python - Python 'dict' 对象没有属性 'status'
- node.js - 在 NodeJS 中获取和发布文本
- sql - 如何根据sql中组内的条件查找行?
- sql - 如何从续集迁移中获取原始 SQL
- xamarin.forms - “由 Xamarin 链接”是什么意思?