Existing work in energy demand side management focuses on the interaction between the utility grid and consumers. However, the previous technique is not focused on energy trading in local community of a renewable energy generation, distributed demand side management and not suitable for real-time environment. This paper presents a distributed demand side management system among multiple homes in community microgrid, with the integration of the internet of things smart meter and in the presence of renewable energy sources. The proposed energy consumption game is formulated for minimizing the cost of electricity in the individual home and the total cost of energy consumption in the whole community. The smart home users are playing game by optimizing their own daily energy consumption of appliances. The multiple participants include the self renewable generation of users, shared community microgrid and optional utility company. Each participant applies its best strategy to minimize energy consumption cost and users can maintain their own privacy of energy consumption. Moreover, the proposed scheme is distributed on blockchain, which provides a trusted communication medium between the participants. It enforces the autonomous monitoring of smart appliances and the billing of electricity consumption via smart contracts. Solidity smart contract is deployed to facilitate the execution of transactions without the involvement of third party in the smart community. Comparison of the results show that the proposed approach minimizes the total cost of energy consumption as well as each user's energy consumption cost.