Blockchain technology has the characteristics of decentralization,non tampering and traceability.The combination of blockchain and charity system can solve the problems of lack of credibility of traditional charity system,data fraud and difficult traceability of donations.However,there are trust problems among charitable organizations.The longterm operation of the blockchain will also lead to the large scale of charitable data,which will bring storage pressure to nodes.These problems need to be improved from the two aspects of blockchain consensus and storage.For the optimization of the Raft consensus mechanism of blockchain,a Leader election mechanism based on node priority is proposed to add a verifier node and change the log submission mode from single step submission to batch submission.These improvements improve the security and efficiency of the Raft algorithm,and make the Raft algorithm more in line with the actual application environment.To solve the problem of high storage pressure on blockchain nodes,an off chain storage technology based on Inter Planar File System is proposed.By transferring data from the chain to the IPFS file system,the storage pressure of blockchain is relieved.Then,according to the consensus and storage optimization,a high-performance blockchain system architecture based on IPFS is designed to provide a new solution for blockchain applications nationwide through the combination of private chain and alliance chain.Finally,the designed blockchain system is applied to charity donation,and the development and testing of charity donation system are completed.The test results show that the improved Raft algorithm can improve the probability of selecting a high-performance node as a leader node,has Byzantine fault tolerance,and increases the average write time by 531 ms.The capacity of the block node is reduced to 25%by the off chain storage based on IPFS,and the system response time is basically less than2.5s,meeting the needs of charitable users.The results show that the optimization scheme for blockchain consensus and storage improves the performance of the system,and can solve the problems of trust in charitable systems and high storage pressure on nodes. |