In my python code I try to send multiples transactions from different address at the same time.
The code build a transaction, sign it and send it, then I print "transaction number n sent" and it continue with the next one. It takes approximately 1 seconde between two print, which means a transaction is sent every 1 seconde, too slow for me.
Is it normal ? Do I need a better computer or internet connexion ? I'm using Infura provider
myContract=w3.eth.contract(address=adresse_contract,abi=abi_contract)
def multi_transactions(gaz_price_gwei):
nonce = w3.eth.getTransactionCount(adresses[0])
for i in range (len(adresse)):
tx = myContract.functions.swap(Token).buildTransaction(
{
'from': adresses[i],
'gas': 200000,
'gasPrice': w3.toWei(gaz_price_gwei,"gwei"),
'nonce' : nonce
} )
signed_tx = w3.eth.account.sign_transaction(tx, keys[i])
w3.eth.sendRawTransaction(signed_tx.rawTransaction)
print("Transaction",i,"sent")
Adresses and keys are arrays. The swap function in my contract just swap on Uniswap. All transaction have the same nonce