Abstract:With the development of blockchain agricultural foods traceability technology, the quality and safety of fruits and vegetables are guaranteed. As the traceability of fruits and vegetables in China has a large span, long traceability cycle and wide coverage, and the blockchain network data ledger is backed up by the joint network nodes, the storage of massive traceability data is under great pressure, while all traceability data are transparently shared, resulting in the data not being able to be all upstream and downstream traceability enterprises to share in a real time, the safety of data is difficult to be effectively guaranteed, and the regulatory departments cannot regular traceability data efficiently. When there is a problem of agricultural foods quality and safety, the responsibility cannot be located and the source of the problem can hardly be found. Based on the above problems, a traceability framework for fruits and vegetables was designed based on blockchain multi-chain architecture, a data storage model was designed, and encrypted storage on the chain of traceability data classification, authorized access between chains and decrypted query based on authorized credentials were realized through smart contracts to ensure the privacy of whole traceability supply chain. Data encryption on the chain can reduce the pressure of storage and realize the sharing of privacy data of upstream and downstream traceability enterprises without silo authorization. Based on the Hyperledger Fabric channel technology of consortium chain, the multi-chain traceability system was realized. After proliferation test, the smart contract scheme of on-chain encryption and evidence storage, inter-chain sharing based on authorized credentials and on-chain decryption query, which was composed of symmetric encryption and elliptic curve hybrid encryption, had a private trace-data cipher text change rate of more than 95% and a key cipher text change rate of more than 94%, which possesses high security and confusion. After performance testing, the average time delay of public traceability data query was 56.9ms, the average time delay of privacy traceability data decryption query was 62.87ms, and the average time delay of processing data upload was 2.16s, which can meet the actual application requirements of fruits and vegetables traceability system. The research result can provide a feasible reference solution for the classification and storage of traceability data of fruits and vegetables in China.