Many smart applications, including smart cities, healthcare, smart agriculture, manufacturing, etc., have widely adopted the Internet of Things (IoT). Smart Farming (SF) integrates a set of technologies, such as cloud and edge computing and greenhouse concepts, to improve agricultural processes. Due to its capacity to generate fresh agricultural products at an incredible pace of development and output, the greenhouse business has recently attracted the attention of the farming community. However, the cost of labor and energy consumption causes the greenhouse’s production cost to rise by roughly 40%–50%. To avoid this, SF concepts have been introduced. Data management in SF has received a lot of attention in recent years due to its high potential for more accurate and cost-effective agriculture. Traditional client–server and cloud-based data management systems are plagued by single faults, data protection, centralized data management, and system vulnerabilities. In this paper, an IoT-based framework is proposed for SF to improve the productivity of crops. AI-based precision model is introduced in the framework, which can be integrated with remote sensor data for correct prediction of crop growth in smart agriculture. The result shows that the random forest model works better with 97% accuracy compared to Support Vector Classifier (SVC) have 93%, K-Nearest Neighbors (KNN) have 90%, and Logistic Regression 84%. This technology helps to reduce costs while also improving the overall quality of the agricultural process and product management with blockchain-based supply chain management to enhance farmers’ economic backdrop. The blockchain performance is evaluated on gas consumption, execution time, throughput and latency.