Demand response (DR) has been studied widely in the smart grid literature, however, there is still a significant gap in approaches that address security, privacy, and robustness of settlement processes simultaneously. The need for security and robustness emerges as a vital property, as Internet of Things (IoT) devices become part of the smart grid; in the form of smart meters, home energy management systems (HEMSs), intelligent transformers, and so on. In this paper, we use energy blockchain to secure energy transactions among customers and the utility. In addition, we formulate a mixed-strategy stochastic game model to address uncertainties in DR contributions of agents and achieve optimal demand response decisions. This model utilizes the processing hardware of customers for block mining, stores customer DR agreements as distributed ledgers, and offers a smart contract and consensus algorithm for energy transaction validation. We use a real dataset of residential demand profiles and photovoltaic (PV) generation to validate the performance of the proposed scheme. The results show the impact of electric vehicle (EV) discharging and customer demand reduction on increasing the probability of successful block mining and improving customer profits. Moreover, the results demonstrate the security and robustness of our consensus algorithm for detecting malicious activities.