The blockchain-assisted swarm robotics system, as an emerging distributed multi-robot system, has been widely discussed and studied for its outstanding advantages in secure communication, data logging and consensus achievement. Due to faults, formation changes, and obstructions, the network topology and communication rate change in the process of multi-robot collaboration, which inevitably affect the stability and operation efficiency of the swarm robotics system. However, few studies have quantitatively assessed the degradation of system stability performance after failure and how to respond to failure of team members and optimize the system for failure. In this paper, the concept of “energy” is introduced into the quantitative evaluation of system failure resistance, and an evaluation model based on communication distance, communication quality and communication volume is proposed, which can evaluate the stability of swarm robotics systems at different moments and any member in real-time collaboration. As the stability improves, the “energy” increases, and vice versa. Additionally, the “energy” balance is applied to the optimization process of multi-robot formation, and the optimization equation based on the efficiency of swarm robots is proposed. The optimal formation efficiency equation of the system at a certain moment is obtained by jointly solving the energy optimization equation and the system. The simulation results show that the proposed formation optimization method can improve the stability of the swarm robotics system at any time and in all directions, and maximize the operational efficiency of the queue.