Abstract. Deadlock detection in concurrent programs that create networks with arbitrary numbers of nodes is extremely complex and solutions either give im-precise answers or do not scale. To enable the analysis of such programs, (1) we define an algorithm for detecting deadlocks of a basic model featuring recursion and fresh name generation: the lam programs, and (2) we design a type system for value passing CCS that returns lam programs. As a byproduct of these two tech-niques, we have an algorithm that is more powerful than previous ones and that can be easily integrated in the current release of TyPiCal, a type-based analyser for pi-calculus.