The International Energy Agency has projected that the total energy demand for electricity in sub-Saharan Africa (SSA) is expected to rise by an average of 4% per year up to 2040. It implies that~620 million people are living without electricity in SSA. Going with the 2030 vision of the United Nations that electricity should be accessible to all, it is important that new technology and methods are provided. In comparison to other nations worldwide, smart grid (SG) is an emerging technology in SSA. SG is an information technology-enhanced power grid, which provides a two-way communication network between energy producers and customers. Also, it includes renewable energy, smart meters, and smart devices that help to manage energy demands and reduce energy generation costs. However, SG is facing inherent difficulties, such as energy theft, lack of trust, security, and privacy issues. Therefore, this paper proposes a blockchain-based decentralized energy system (BDES) to accelerate rural and urban electrification by improving service delivery while minimizing the cost of generation and addressing historical antipathy and cybersecurity risk within SSA. Additionally, energy insufficiency and fixed pricing schemes may raise concerns in SG, such as the imbalance of order. The paper also introduces a blockchain-based energy trading system, which includes price negotiation and incentive mechanisms to address the imbalance of order. Moreover, existing models for energy planning do not consider the effect of fill rate (FR) and service level (SL). A blockchain levelized cost of energy (BLCOE) is proposed as the least-cost solution that measures the impact of energy reliability on generation cost using FR and SL. Simulation results are presented to show the performance of the proposed model and the least-cost option varies with relative energy generation cost of centralized, decentralized and BDES infrastructure. Case studies of Burkina Faso, Cote d'Ivoire, Gambia, Liberia, Mali, and Senegal illustrate situations that are more suitable for BDES. For other SSA countries, BDES can cost-effectively service a large population and regions. Additionally, BLCOE reduces energy costs by approximately 95% for battery and 75% for the solar modules. The future BLCOE varies across SSA on an average of about 0.049 $/kWh as compared to 0.15 $/kWh of an existing system in the literature.