Blockchain has been used in several domains. However, this technology still has major limitations that are largely related to one of its core components, namely the consensus protocol/algorithm. Several solutions have been proposed in literature and some of them are based on the use of Machine Learning (ML) methods. The ML-based consensus algorithms usually waste the work done by the (contributing/participating) nodes, as only winners' ML models are considered/used, resulting in low energy efficiency. To reduce energy waste and improve scalability, this paper proposes an AI-enabled consensus algorithm (named AICons) driven by energy preservation and fairness of rewarding nodes based on their contribution. In particular, the local ML models trained by all nodes are utilised to generate a global ML model for selecting winners, which reduces energy waste. Considering the fairness of the rewards, we innovatively designed a utility function for the Shapley value evaluation equation to evaluate the contribution of each node from three aspects, namely ML model accuracy, energy consumption, and network bandwidth. The three aspects are combined into a single Shapley value to reflect the contribution of each node in a blockchain system. Extensive experiments were carried out to evaluate fairness, scalability, and profitability of the proposed solution. In particular, AICons has an evenly distributed reward-contribution ratio across nodes, handling 38.4 more transactions per second, and allowing nodes to get more profit to support a bigger network than the state-of-the-art schemes.