I would like (if possible) to read the exact trade made in a transaction where and address interact with Uniswap (or other DEX) using web3.

Using Etherscan is quite simple to read the tokens swapped in a transaction, see for example https://etherscan.io/tx/0x28dc4fd2364440a60a2e027de0f9b3d77cb1420ecd8662637224e5f5ecb9695a in transaction action.

My final purpose would be that for a given transaction extract the same information.

Thank you in advance!


2 Answers 2


You can get a transaction by it's hash via calling getTransaction. The returned object contains all the details you see in block explorers like Etherscan.


Ethereum transaction contains

  • input (call data)

  • output (receipts)

Both need to be analysed to underthe Uniswap trades fully. web3-ethereum-defi package provides function uniswap_v3.analyse_trade_by_hash() that decodes the transaction for you.

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.