TOSSIM is a scalable and accurate simulator for TinyOS applications that: 1) Simulates entire TinyOS applications at the component level, replacing hardware with software to model interrupts as events. 2) Compiles applications directly from TinyOS source code to run on either the simulator or hardware with no changes required. 3) Is scalable to thousands of nodes through static memory modeling and handles fine-grained system behavior and interactions through bit-level simulation.