The volume of data traffic has increased exponentially due to the explosive growth of IoT devices and the arrival of many new IoT applications. Due to the large volume of data generated from IoT devices, limited bandwidth, high latency, and realtime analysis requirements, the conventional centralized network architecture cannot meet users requirements. Intensive real-time data analysis is one of the major challenges in current state-ofthe- art centralized architectures due to the ubiquitous deployment of different types of sensors. To address the current challenges and adhere to the principles of architectural design, we are proposing a SoftEdgeNet model, which is a novel SDN-based distributed layered network architecture with a blockchain technique for a sustainable edge computing network. At the fog layer, we introduce an SDN-based secure fog node architecture to mitigate security attacks and provide real-time analytics services. We are also proposing a flow rule partition, and allocation algorithm at the edge of the network. The evaluation result shows our proposed model allows for a significant improvement of the interactions in real time data transmission. In terms of the ability to mitigate flooding attacks, the bandwidth is maintained above 9 Mb/s until the attack rates exceed 2000 PPS in the hardware environment and the bandwidth remained almost unchanged in the software environment. In the case of scalability of the proposed model, our proposed algorithm has performed better and proceeded linearly with the increase in traffic volume.