Fundamental building blocks of life have been detected extraterrestrially, even in interstellar space, and are known to form nonenzymatically. Thus, the HCN pentamer, adenine (a base present in DNA and RNA), was first isolated in abiogenic experiments from an aqueous solution of ammonia and HCN in 1960. Although many variations of the reaction conditions giving adenine have been reported since then, the mechanistic details remain unexplored. Our predictions are based on extensive computations of sequences of reaction steps along several possible mechanistic routes. H2O- or NH3-catalyzed pathways are more favorable than uncatalyzed neutral or anionic alternatives, and they may well have been the major source of adenine on primitive earth. Our report provides a more detailed understanding of some of the chemical processes involved in chemical evolution, and a partial answer to the fundamental question of molecular biogenesis. Our investigation should trigger similar explorations of the detailed mechanisms of the abiotic formation of the remaining nucleic acid bases and other biologically relevant molecules.