Edge computing is a distributed computing model in which processing takes place close to where the data is generated and used. This model brings many benefits in terms of latency, reliability, and security at the price of greater management complexity. These advantages are particularly useful in critical infrastructure management (energy, transport, health, safety) and industrial control applications. The greater complexity stems from the large number of nodes with heterogeneous network technologies and in a difficult or hostile environment. In the Bonsai lab, we study the algorithms and technologies that allow the large-scale management of computing nodes with limited resources and heterogeneous networks. The laboratory is equipped with 5G network emulators and programmable switches. The research exploits advanced cryptographic techniques (homomorphic cryptography, smart contracts) and both traditional and machine learning-based optimization techniques.