This paper develops a structural model of demand for illegal drug varieties and studies how consumers substitute between different types of drugs in response to government policies. We use a unique longitudinal dataset on prices, quantities, and individual decisions that we obtained by scraping a darknet marketplace that covered the majority of the retail illegal drug trade in Russia. The estimated model is used to evaluate counterfactual drug policies. We find that the legalization of cannabis has the benefit of decreasing the use of riskier drugs while increasing cannabis use. Finally, our model helps identify the optimal drugs to target for interdiction, specifically those without close substitutes, such as Alpha-PVP.