As is well known, computer security has been given more attention; many mechanisms have been developed to increase P2P security like encryption, sandboxing, reputation, and firewall. Among those technologies, reputation mechanism as an active method is especially useful to automatically record, analyze and adjust peers' reputation, trust, histories among the different peers, and this method is suitable for our anonymous and dynamic P2P environment. Therefore, reputation-based trust mechanism is a secure enough reputation system. In this paper, we present a new reputation-based trust management model to prevent the spread of malicious content in the open community using a resource chain model. The main idea of the resource chain model is using a routing table to record the information of nodes' credibility and their recommending nodes' credibility. Therefore, using this model can help us to find the best and safest resource location efficiently and decrease the number of malicious transactions.