I have a simple script where i send Native tokens from A to B.
but for some reason it doesnt work anymore
I keep getting this error:
ValueError: {'code': -32000, 'message': 'only replay-protected (EIP-155) transactions allowed over RPC'}
bsc = ‘https://speedy-nodes-nyc.moralis.io/adfadf/polygon/mainnet’
web3 = Web3(Web3.HTTPProvider(bsc))
print(web3.isConnected())
senderPublic = web3.toChecksumAddress(‘address A’)
to = web3.toChecksumAddress(‘address B’)
amountToTransfer = 0.01
def transaction():
nonce = web3.eth.getTransactionCount(senderPublic)
print(nonce)
#build a transaction in a dictionary
tx = {
'nonce': nonce,
'to': to,
'value': web3.toWei(amountToTransfer, 'ether'),
'gas': 21000,
'gasPrice': web3.toWei('5', 'gwei')
}
time.sleep(5)
#sign the transaction
signed_tx = web3.eth.account.sign_transaction(tx, privateKey)
#send transaction
tx_hash = web3.eth.sendRawTransaction(signed_tx.rawTransaction)
#get transaction hash
print(web3.toHex(tx_hash))
print(f'transaction has been sent to {to}')
print(‘send’)
transaction()
I have now tried every node, always the same error and i cant figure out what i do wrong