Sustaining cooperation among self-interested agents is critical for the proliferation of emerging networked communities, such as the communities formed by social networking services. Providing incentives for cooperation in networked communities is particularly challenging because of their unique features: a large population of anonymous agents interacting infrequently, having asymmetric interests, and dynamically joining and leaving the network; network operation errors; and low-cost identity whitewashing. In this paper, taking these features into consideration, we propose a framework for the design and analysis of a class of incentive schemes based on social norms. We first define the concept of sustainable social norm under which no agent has an incentive to deviate. We then formulate the problem of designing an optimal social norm, which selects a social norm that maximizes overall social welfare among all sustainable social norms. Using the proposed framework, we study the structure of optimal social norms and the impacts of punishment lengths and whitewashing on optimal social norms. Our results show that optimal social norms are capable of sustaining cooperation, with the amount of cooperation varying depending on the community characteristics.