---
title: "Comment by Hu xinya on \"Preventing Denial of Service Attacks in Smart Contracts: Implementing the Withdrawal Pattern\" | Hashnode"
description: "Great post—this is an often overlooked vulnerability in Solidity. One quick best practice: always favor the pull over push pattern for payments, using a withdra"
url: "https://hashnode.com/posts/preventing-denial-of-service-attacks-in-smart-contracts-implementing-the-withdrawal-pattern/67dd7bb9cf09a070e54cd8e9/comment/69f8a1b60bd27da175ad74ae"
---

[Discussion](https://hashnode.com/posts/preventing-denial-of-service-attacks-in-smart-contracts-implementing-the-withdrawal-pattern/67dd7bb9cf09a070e54cd8e9)

Comment [Preventing Denial of Service Attacks in Smart Contracts: Implementing the Withdrawal Pattern](https://hashnode.com/posts/preventing-denial-of-service-attacks-in-smart-contracts-implementing-the-withdrawal-pattern/67dd7bb9cf09a070e54cd8e9)

[Hu xinya](https://hashnode.com/@xinya)

[May 4](https://hashnode.com/posts/preventing-denial-of-service-attacks-in-smart-contracts-implementing-the-withdrawal-pattern/67dd7bb9cf09a070e54cd8e9/comment/69f8a1b60bd27da175ad74ae)

Great post—this is an often overlooked vulnerability in Solidity. One quick best practice: always favor the _pull over push_ pattern for payments, using a `withdraw()` function instead of sending Ether directly in a loop, to avoid gas griefing and out-of-gas reverts. For extra safety, consider implementing a withdrawal cooldown or a Merkle-tree-based claims system for high-volume scenarios.
