Today we’ll see How to perform and prevent Dos-Attack by rejecting Ether.
I’ll show a practical example of a contract vulnerable to dos attack by rejecting ether and how to prevent this attack by using a design pattern called pull over push pattern
we’ll perform dos attack where the currentLeader is a contract address (the attacker contract) that cannot receive ether.
And when anyone else tries to become the current leader they can’t because the transaction will revert because our contract cannot receive ether(forever).
So we cannot set new currentLeader forever.
——————————————————————————————————–
⚠️ Don’t click this link – https://www.youtube.com/channel/UCmI997WuJrWc5CXeRGqCQlQ?sub_confirmation=1
——————————————————————————————————–
💻 Source code –
[Link to gist](https://gist.github.com/ViktorKuzmanov/a79e6f1f4ee647f43a297716a7d0e7c2)
Buy Trezor Hardware Wallet – https://shop.trezor.io/product/trezor-one-black?offer_id=35&aff_id=9504
——————————————————————————————————-
Disclaimer: When you purchase through links on our site I may earn an affiliate commission.
Disclaimer 2: Anything I say in this video is not financial advice, it’s for entertainment and educational purposes only. I’m not a financial advisor.