Peer-to-peer (P2P) trading in a local energy market (LEM) offers various participants the opportunity to negotiate and strike energy deals among themselves using a distributed ledger technology called blockchain. In this paper, a new local model is presented using a layer-2 scalability solution for secondgeneration (Gen2) blockchain technology to enable P2P trading among four types of participants: consumers, prosumers with solar photovoltaic (PV) systems, prosumers with solar PV systems and battery energy storage systems (BESSs), and electric vehicles (EVs). The proposed LEM trading platform involves several critical steps, including the creation of typical forecasting profiles for load consumption, solar generation, and battery state-of-charge (SOC) through a forecasting solution. Next, the LEM participants place their pricing bids using a trading agent service, and the trading engine collects the profiles data and bid prices, which performs matchmaking in a forward-facing market. The output of the trading engine consists of dispatch signals for prices and energy values that are sent to each participant to execute actual trading. Furthermore, the trading engines store the accepted and past bidding data and energy values of P2P trades for each participant in blockchain technology, which can be retrieved and displayed on the LEM user interface screens of participants and administrators using their blockchain addresses at any time during the trading process. This study focuses on simulating proposed LEM models, incorporating functional limitations and market rules. These rules aim to reduce energy costs, enhance margins for utilities and retailers, and mitigate grid congestion through BESSs, resulting in reduced operational and capital expenditure. LEM outcomes are analysed and compared with a Business-as-usual (BAU) model. Participants' energy trading behaviour, costrevenue dynamics, grid impact, and blockchain implementation costs are explored. The study highlights LEM benefits in terms of reduced CO2 emissions by 984 kg CO2, increased self-sufficiency by 2.2%, and improved financial benefits of all participants by 21.6%. The use of modern blockchain technology guarantees secure data storage and rapid, cost-effective energy trading, thereby making the proposed LEM platform a viable solution in the distribution market.INDEX TERMS Blockchain technology, forecasting service, LEM, P2P energy trading, smart contracts.