Despite numerous attempts, an adequate theoretical and experimental simulation of ball lightning still remains incomplete. According to the model proposed here, the processes of electrochemical oxidation within separate aerosol particles are the basis for this phenomenon, and ball lightning is a cloud of composite nano or submicron particles, where each particle is a spontaneously formed nanobattery which is short-circuited by the surface discharge because it is of such a small size. As free discharge-shorted current loops, aerosol nanobatteries are exposed to a powerful mutual magnetic dipole dipole attraction. The gaseous products and thermal energy produced by each nanobattery as a result of the intra-particle self-sustaining electrochemical reactions, cause a mutual repulsion of these particles over short distances and prevent their aggregation, while a collectivization of the current loops of separate particles, due to the electric arc overlapping between adjacent particles, weakens their mutual magnetic attraction over short distances. Discharge currents in the range of several amperes to several thousand amperes as well as the pre-explosive mega ampere currents, generated in the reduction oxidation reactions and distributed between all the aerosol particles, explain both the magnetic attraction between the elements of the ball lightning substance and the impressive electromagnetic effects of ball lightning.