Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
How to send TX in the same block with emitted event in ethers.js

I am listening to a specific contract on the blockchain and when a certain event occurs on the contract, I send a TX. In the best case my TX is mined in the next block of the specific event that I am using as my trigger.

In blockchain explorer I see some addresses whose TX's are mined in the exact same block as their trigger events.

My question is how can I send a TX to be mined in the same block as the emitted contract event that I am using as my trigger?

I am currently using ethers.js as follows

filter = {address: "0x...."}   // Contract address that I am listening to

// Start listening
provider.on(filter,  async (_event) => {

// Do something with _event when a TX is emitted

// Sign a raw TX if certain criteria is met
    await send_tx(tx_data, gasPrice, gasLimit)
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!