As agricultural products safety has a significant impact on peoples lives, it is of great significance to establish and improve the safety regulation system. Meanwhile, the rapid development of blockchain technology provides a new regulation method for the agricultural products safety issue. However, the exist blockchain query methods can not be apply to agricultural IoT directly. Besides, block generation speed of the exist methods are difficult to improve when memorizing massive IoT data. To solve the above problem, firstly, a blockchain query scheme based on hash database is proposed. The database stores the mapping among IoT data, transaction hash and block hash. Then, we put forward the anomalous data detection method based on voice prediction model. The memory depth and normal range of various products is set by domain expert to detecting abnormal data. To this end, we improve the ethereum workshop block generation mechanism and presented an adaptive adjustment strategy for mining difficulty based on data variation. The experi-mental results show that the proposed approach can outperforms the existing methods.