ValueError: {‘code‘: -32000, ‘message‘: ‘only replay-protected (EIP-155) transactions allowed over R

解决办法

You'll need to add chainId to your transaction object to save your tx from being replayed on other chains.

tx = {
    'chainId': 3, // for ropsten
    'nonce': nonce,
    'to': account_2,
    'value': web3.toWei(float_amount, 'ether'),
    'gas': 21000,
    'gasPrice': web3.toWei(50, 'gwei')
}

Check here for chain IDs of all EVM based chain

问题:

Good afternoon, after having been developing a blockchain web app for some months, it's the first time I get this error when making a transaction.

ValueError: {'code': -32000, 'message': 'only replay-protected (EIP-155) transactions allowed over RPC'}

This is my code. It has always worked, and I guess it's not a matter of code, it might be just a matter of Web3, but I'm asking just in case. Thanks in advance.

tx = {
        'nonce': nonce,
        'to': account_2,
        'value': web3.toWei(float_amount, 'ether'),
        'gas': 21000,
        'gasPrice': web3.toWei(50, 'gwei')
    }
    signed_tx = web3.eth.account.sign_transaction(tx, private_key)
    tx_hash = web3.eth.send_raw_transaction(web3.toHex(signed_tx.rawTransaction))

原文:

https://ethereum.stackexchange.com/questions/94412/valueerror-code-32000-message-only-replay-protected-eip-155-transac

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值