0

I am currently in a situation where I need to send multiple transactions simultaneously. I see that it is possible as some accounts can send 10 or even more transactions per second, and their transactions end up in every block. Right now, I am using the following method with threading:

for txn in group:
    thread = threading.Thread(target=send_transaction_in_thread, args=(client, txn, signers))
    threads.append(thread)
    thread.start()

for thread in threads:
    thread.join()

send_transaction_in_thread function is simply this:

def send_transaction_in_thread(client, txn, signers):
    client.send_transaction(txn, *signers, opts=TxOpts(skip_preflight=True))

These are all different transactions. However, even though I use this method, it does not yield the desired result, even when I use multiple RPCs to bypass limits and adjust the priority fee according to network congestion. Currently, I am sending 30 transactions in threads, but still, sometimes these transactions can have a small interval between them, and sometimes a very large one, with a distance of ~10 blocks between them. I feel that the threading method is not ideal. What is the best approach for me to use? Or do I need to use even more transactions for sending (more than 30)?"

2 Answers 2

0

The most important thing to realize with this issue is that it's not your fault! You're doing the right thing.

There's no way to guarantee that your transactions all land at the same time, even with high priority fees. For example, you could get throttled by an RPC provider and have to wait some time before sending your next transaction.

Or the RPC node that you're sending transactions to might get throttled by validators later in the chain.

The key is that there's no way to do this perfectly, unless you work out a side deal with a leader node. You might want to look into MEV solutions to send your transactions as a batch to make sure they're all processed at the same time.

0

You can use the jito bundle. In this case, you can send 5 transactions at once and they will all land together

https://www.jito.wtf/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.