Traditional traceability system has problems of centralized management, opaque information untrustworthy data, and easy generation of information islands. To solve the above problems, this paper designs a traceability system based on blockchain technology for storage and query of product information in supply chain of agricultural products. Leveraging the characteristics of decentralization, tamper-proof and traceability of blockchain technology, the transparency and credibility of traceability information increased. A dual storage structure of ‘‘database +
blockchain’’ on-chain and off-chain traceability information is constructed to reduce load pressure of the chain and realize efficient information query. Blockchain technology combined with cryptography is proposed to realize the safe sharing of private information in the blockchain network. In addition, we design a reputation-based smart contract to incentivize network nodes to upload traceability data.Furthermore, we provide performance analysis and practical application, the results show that our system improves the query efficiency and the security of private information, guarantees the authenticity and reliability of data in supply chain management, and meets actual application requirements.