Cocaine comes from the leaf of the coca tree, which is grown in South America, normally Columbia, Bolivia and Peru. It has been used for millennia, and it was brought to Europe for study by the Spanish. Its euphoric and anesthetic properties were discovered around 1860, and it soon became widely available.
The extraction process was the original barrier to purifying cocaine from the leaves, but the method was created and then improved repeatedly. It’s a relative simple process, but it requires some time and needs certain materials that were not available until the early 19th century. In 1855, it was extracted for the first time.