Food safety has become an important topic in people’s daily lives. In recent years, the frequent occurrence of food safety incidents have caused a crisis of trust between consumers and the food industry. Accordingly, there is an urgent need to establish an efficient and trusted traceability system for agricultural products. In the practical application of the traditional traceability system, the data of the production, processing, packaging, transportation, storage and sales of agricultural products are stored in the local database of each node, data in traditional traceability systems is centralized, and authoritative agencies manage the central database of the traceability system. Because the traceability data of each supply chain node is managed by the enterprise itself, the data is easy to be tampered with. Therefore, it is necessary to improve the reliability of information transmission between different roles in agricultural supply chain.Blockchain has the characteristics of decentralization, non-tampering, traceability, and high availability. Using these characteristics of blockchain and using blockchain technology to trace agricultural products, it is possible to solve the problems existing in the current traditional traceability system.At present, Scholars in China and abroad have studied the application of blockchain in the field of traceability. However, the traceability system of blockchain have some problems, such as low query efficiency, high data-storage load, and poor data privacy and security. In order to solve the above problems, this study designed a storage structure for a blockchain-based traceability system for agricultural products based on Hyperledger Fabric and proposed an index storage and query method for gtraceability information. In this method, “On chain and off chain” data storage technology is used, the enterprise first digitally signs the hash value of the traceability information of agricultural products, writes the hash value into the blockchain, and returns the block number to the blockchain where the hash value is located. Then, the traceability information of agricultural products and the block number are stored in the local database of each node. If the information of agricultural products needs to be modified, it is necessary to rewrite the hash value of the traceability information to the blockchain and update the block number. When consumers scan the QR code of agricultural products, the traceability information and block number is obtained from the local database, the value is calculated by hash algorithm for the acquired traceability information, and compare it with this newly acquired hash value with the hash value stored in the blockchain by block number to verify the authenticity of traceability information of agricultural products. The result showed that, when the number of total traceability records reached 11×104 in the blockchain and the number of batch traceability records was 400 respectively, the query efficiency of the newly proposed method was increased by 70.56% and 88.66% compared to two traditional blockchain-based data query methods of query performed using the value of key attribute and querying performed using the batch number of agricultural products through the rich query of the CouchDB database, respectively. The approach of this paper effectively solves the problem of excessive load pressure of blockchain data storage, ensures data privacy and security, and improves the reliability and timeliness of traceability information. [ABSTRACT FROM AUTHOR]