How does eth_sendTransaction work?

Hi,

Just curious how the flow here works:

  1. sendTransaction called → transaction created on blockchain → confirm transaction in MetaMask notification popup → if confirmed transaction gets validated or somethinng

or

  1. sendTransaction called → confirm transaction in MetaMask notification popup → transaction is created

Im curios of how and where MetaMask or any other wallet listens if eth_sendTransaction got called and how do they know if they need to open the confirm transaction view? Is there any place you can listen for those events with the wallet holder address?

1 Like

Hi @djole90.

The flow would be as described in the first example. As soon as it is confirmed, it’s registered on the blockchain and processed.

Here is how what you described works:

3 Likes

Thank you.

But where is the transaction before it gets confirmed in the MetaMask notification popup, how or where can i intercept it?

To be clear on what I’m trying to achieve:

My goal is to programmatically analyze an address (“to” address) in my extension, before confirming the transaction. So what i need is, to intercept or listen to rpc requests, especially eth_sendTransaction, from the browser and catch the “to” address so i can analyze it.

Any idea how i could do it?

1 Like

I would suggest you to visit the MetaMask github repository and search for it thoroughly. Here it is:

Besides that, i gathered a few other sources of information for you:

3 Likes