### Tool in action - <div style="position: relative; padding-bottom: 56.25%; height: 0;"><iframe src="https://www.loom.com/embed/47e07916302042bf9a081c32b2591933?sid=cf62b439-5a49-4e3d-b729-a4a14bae3f85" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe></div> ## Application and usage This MSA based event driven Microservice is built to monitor various transactions towards a specific contract and to trigger a specific action based on the transaction type if malicious. ![Screenshot 2023-04-13 170829](https://user-images.githubusercontent.com/81789395/231747863-17e65eb3-9eda-4343-ba20-cebca0fcb115.png) Note : The contract code is deliberately made vulnerable to reentrancy attack and TOD attack for demonstration purpose. Current MVP version is built to monitor reentrancy attack and Transaction-Ordering Dependence (TOD) Attack. All the events emitted are also stored in mongoDB There are 3 microservices in this project: 1. Listener_MS - This microservice listens to the following events a. Stake --stakes ether from user b. Unstake --unstakes ether from contract 2. MemPool_MS - this microservice monitors the mempool for following interaction patterns to PAUSE THE CONTRACT a. Same function being called consecutively by same address within 20 blocks b. Gas sent for the transaction is less than required c. Stake and unstake are called within 20 blocks of each other d. consecutive ether transfer from contract within 20 blocks 3. Mailing_MS - This microservice sends an email to the owner of smartcontract upon event emit of stake or unstake. 4. Kafka Docker setup - a single channel called stakeClient is used to communicate between Listener_MS and Mailer_MS. ## The codespace is live share enabled Ping me at muskbuster #6052 to get access to the live share session and we can have a live demo