错误将资产发送到使用Python/web3的二元地址3
我试图将带有Python脚本的信任纸的BNB发送到我的binance帐户。
简单功能:
def send_bnb(to_public, from_public, from_secret, amount):
nonce = web3.eth.getTransactionCount(from_public)
tx = {
'chainId': 97,
'to': to_public,
'nonce': nonce,
'value': web3.toWei( amount,'ether'),
'gas': 21000,
'gasPrice': web3.toWei('50','gwei')
}
signed_tx = web3.eth.account.signTransaction( tx, from_secret)
return web3.eth.sendRawTransaction(signed_tx.rawTransaction)
在两个信任 - 含税地址之间正常工作,但是如果我尝试将其发送到我的Binance地址,则会失败。
错误是:
TypeError:事务的字段无效:{'to':< to_public>}
原因可以连接到地址中的上下案例字母的使用,因为我会遇到相同的错误,如果我转换了工作信任 -较低案件的地址。 但是到目前为止,我没有发现任何暗示。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过一番研究,我在必须具有EIP55校验和。但是,由于API提供了检查和创建这些功能的功能,因此我认为我尝试了一下,并且可以使用!
因此,在功能开始时添加了一条线之后:
它可以使用。
After some more research I found the solution in the Web3.py Documentation. To me, it's not clearly stated there, that addresses must have an EIP55 checksum. But as the API provides functions to check and create these, I thought I give it a try, and it worked!
So after adding an additional line at the beginning of the function:
it worked.