Ensuring the traceability of agricultural products is essential for quality control and food safety. Recent technological advances have provided new ways to enhance traceability systems. This study aims to use blockchain technology, centralized database and RFID tags to develop a secure agricultural product traceability system, retain the detailed information of agricultural products traceability, ensure that the summary information of agricultural products on the chain cannot be modified, and optimize the SM3 algorithm to effectively summarize the traceability data and improve the efficiency of the system. The aggregated data is time-stamped, recorded on the blockchain, and written into an RFID tag. The optimization of the SM3 algorithm improved the efficiency by 30% and reduced the execution time of 192-byte messages to 210µs. The system ensures accurate linking of traceability data through secure data retention and unalterable summaries on the blockchain. The integrated use of blockchain, centralized database and RFID technology, as well as the enhanced SM3 algorithm, allows the system to meet the standards for data accuracy and performance requirements in agricultural traceability applications.