As the increase of access to the power grid of prosumers with distributed generation devices, the demand for transactions between prosumers and the decentralized nature of the trading are becoming prominent, so the P2P energy trading mode is proposed. Firstly, the framework of P2P trading is established, the main trading process is clarified, and the bidding strategy of the participant is given. Secondly, in order to restrain the behavior of the participants in transactions, maintain the market order, the mechanism of credit evaluation when settled is put forward. Finally, taking a microgrid with 10 users as an example for trading simulation to validate the feasibility and advantages of the P2P trading mode and trading mechanism, and verifying the practicality by analyzing the effect of bidding strategy and credit evaluation mechanism on the participant's transactions and profit.