Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda