—Modular software, in which strongly-separated units of functionality can be independently added to and removed from a node’s running software, offers a promising approach to effective dynamic software updating in Wireless Sensor Networks (WSNs). Modular software updating approaches offer high efficiency, in terms of both network costs and update installation at nodes, as well as low disruption, allowing existing software to continue to operate during updates. Existing approaches however critically lack safety, relying on weakly-typed eventogramming abstractions for inter-module interaction. This precludes compile-time or composition-time verification of interoperability between dynamically loaded modules and therefore presents major risks for future large-scale productionclass deployments. In this paper we present Lorien: a componentbased modular operating environment that employs interfacebased inter-component interaction to support completely typesafe software composition, whi...