LEAVING vacuum-sealed bags, digital scales and stashes of marijuana lying around was a mistake. So was getting T-shirts and hoodies emblazoned with “Cali Connect”, under which name drugs were dealt online. Selling pot to an undercover officer was a further slip-up. All this is part of the prosecution evidence in an ongoing case against David Burchard in California. But the crucial piece of evidence, according to the police who arrested him in March, was that he had trademarked Cali Connect to protect his brand.

Mr Burchard is awaiting trial; the charges against him may be demolished in court. But even if the police officers’ story does not hold up, in its outline it is typical of recent developments in the drug trade. Though online markets still account for a small share of illicit drug sales, they are growing fast—and changing drug-dealing as they grow. Sellers are competing on price and quality, and seeking to build reputable brands. Turnover has risen from an estimated $15m-17m in 2012 to $150m-180m in 2015. And the share of American drug-takers who have got high with the help of a website jumped from 8% in 2014 to 15% this year, according to the Global Drug Survey, an online study.

Online drug markets are part of the “dark web”: sites only accessible through browsers such as Tor, which route communications via several computers and layers of encryption, making them almost impossible for law enforcement to track. Buyers and sellers make contact using e-mail providers such as Sigaint, a secure dark-web service, and encryption software such as Pretty Good Privacy (PGP). They settle up in bitcoin, a digital currency that can be exchanged for the old-fashioned sort and that offers near-anonymity during a deal.

Almost all sales are via “cryptomarkets”: dark websites that act as shop-fronts. These provide an escrow service, holding payments until customers agree to the bitcoin being released. Feedback systems like those on legitimate sites such as Amazon and eBay allow buyers to rate their purchases and to leave comments, helping other customers to choose a trustworthy supplier. The administrators take a 5-10% cut of each sale and set broad policy (for example, whether to allow the sale of guns). They pay moderators in bitcoin to run customer forums and handle complaints.

Once a deal is struck and payment is waiting in escrow, drugs are packed in a vacuum-sealed bag using latex gloves to avoid leaving fingerprints or traces of DNA, and dipped in bleach as a further precaution against leaving forensic traces. A label is printed (customs officials are suspicious of handwritten addresses on international packages). Smart sellers use several post offices, all far from their homes—and, preferably, not overlooked by CCTV cameras. Some offer to send empty packages to new customers, so they can check for signs of inspection. Smart buyers use the address of an inattentive or absent neighbour with an accessible postbox, and never sign for receipt. Judging by the reviews, around 90% of shipments get through.

Despite the elaborate precautions, until now cryptomarkets have tended not to last long. The first, Silk Road, survived almost three years until the FBI tracked down its administrator, Ross Ulbricht, aka “Dread Pirate Roberts”. He is serving a life sentence for money-laundering, computer-hacking and conspiracy to sell narcotics. Its successor, Silk Road 2, lasted just a year before law-enforcement caught up with it. Buyers and sellers migrated to the next-biggest sites, Evolution and Agora. The former vanished in March 2015 with $12m-worth of customers’ bitcoin in an “exit scam”. Then Agora disappeared, claiming that it had to fix security flaws. The biggest still standing is Alphabay, though the recently opened fourth version of Silk Road could knock it off the top spot.

Quality assurance

The secretive nature of dark-web markets makes them difficult to study. But last year a researcher using the pseudonym Gwern Branwen cast some light on them. Roughly once a week between December 2013 and July 2015, programmes he had written crawled 90-odd cryptomarkets, archiving a snapshot of each page.

The Economist has extracted data from the resulting 1.5 terabytes of information for around 360,000 sales between December 2013 and July 2015 on Agora, Evolution and Silk Road 2. In total the deals were worth around $50m. For each transaction we know what was sold, the price in bitcoin, the date of completion, shipping details, the customer’s rating and the vendor’s pseudonym.

There are, inevitably, flaws in the data. Mr Branwen’s scrapes probably missed some deals. We excluded any sale that was more than a week old when the scrape took place. If a price was absurdly high we ignored the page; such “holding prices” are used by dealers to indicate a lack of supply. Vendors may fake sales (though probably not often, since cryptomarkets take a cut) or reviews (though dissatisfied real customers would soon catch outright fraudsters). The volatile exchange rate between bitcoin and dollars means our conversions of prices are not completely accurate.

MDMA (ecstasy) sold the most by value (see graphic). Marijuana was the most popular product, with around 38,000 sales. Legal drugs such as oxycodone and diazepam (Valium) were also popular. A third of sales did not belong in any of our categories: these included drug kit such as bongs, and drugs described in ways that buyers presumably understood, but we did not (Barney’s Farm; Pink Panther; Gorilla Glue).

Some of the products cater to niche interests. You can consume “with a good conscious [sic]”, promises one vendor for his “ethically sourced” THC chocolate, which costs 13% more than the ordinary, immoral stuff. “Conflict-free” cocaine is also available for the humanitarian (or delusional) drug-taker. And “social” coke—a less pure version sold at a discount of 5-25%—is aimed at buyers who want to look lavish on a budget.

The first striking finding is that drugs bought on the dark web are comparatively pricey (see chart 1). Even though buyers can browse for a bargain, in most countries a gram of heroin costs roughly twice as much online as on the street. The markup for cocaine is around 40%.

Australia bucks this trend. Narcotics prices there are usually three or four times higher than the rich-world average. Australia is so remote that sending drugs there is much more expensive, plus their customs officials are better at securing their border, notes David Décary-Hétu, a cyber-security expert at Montreal University. But the competition from an international market drives online prices below those on the street. Using the postal system makes arbitrage possible, says Nicolas Christin of Carnegie Mellon University. An enterprising dealer could, for instance, pick up a gram of heroin from the Netherlands for $75. If it makes it through customs into Australia, the price jumps to $288.

One reason for the higher price of dark-web drugs in most of the world, says Mr Christin, is that vendors must build in some of the cost of parcels being intercepted (some promise to split the loss with the seller; others say they will abide by a moderator’s decision). And using the postal system makes it hard to introduce economies of scale. To avoid suspicion, vendors do not buy vacuum-seal bags in bulk. A package can take an hour to prepare. The common precaution of using a distant post office is costly: on an online forum, one dealer complains that dispatching a single package a day would mean losing money on petrol alone. Postage and packing raises prices as much as 28% (see chart 2).

The main reason for the online price premium, though, appears to be that dark-web drugs are of higher quality. If you order from someone with thousands of reviews you are unlikely to get a poison in place of a psychedelic, explains a regular buyer of LSD. An online dealer who flogs dross gets bad reviews and loses clients. A study by Energy Control, a Spanish think-tank that asked volunteers to send samples of dark-web drugs for testing, confirms the existence of this quality premium. It found an average purity level for cocaine, the drug for which it gathered the most data, of 71.6%, compared with 48% for cocaine bought on Spanish streets. Over half of the dark-web samples contained nothing but cocaine, compared with just 14% of those bought offline. Taking purity into account, it is probably cheaper to score online than via your local dealer, says Judith Aldridge of Manchester University. The price gap differs from drug to drug. Some of the variation can be explained by where the cryptomarket sits in the supply chain. With the right know-how and access to chemicals it is possible to produce synthetic drugs such as LSD and ecstasy anywhere. Cannabis can be grown indoors, if bathed in high-powered electric light. But heroin and cocaine still have to be sourced from Afghanistan or Latin America. So their sellers, even online, are likely to be middlemen, with the associated risks, rather than producers. For most drugs, though, cryptomarkets allow dealers to avoid the dangers they face on the street. They no longer run such risks as being shot by a rival or stabbed by a junkie. Customers are less likely to be arrested, or sold dodgy products. But there are also new dangers.

Ms Aldridge points to “doxxing”—the release of personal details online—as one. An aggrieved (or opportunistic) vendor who thinks a customer’s review was unfair may publish the delivery address or threaten blackmail. On a forum, one user complains that he received a letter postmarked Hawaii saying that someone “has my info and he’s going to give it to the cops” unless five bitcoin ($1,217 at the time) are sent to an untraceable account. And cryptomarkets themselves have suffered distributed denial-of-service attacks, in which a website is brought down by a flood of bogus page requests. These may be orchestrated by rivals who want to grab market share, says James Martin, a cryptomarket expert at Macquarie University in Australia, just as offline gangs engage in turf wars.

Medicine man

As the drug trade moves to cryptomarkets, ancillary services are springing up. Outfits such as Mr420 claim to offer vendors public-relations services—and fake reviews. Online forums allow dark-web users to warn each other about rip-off vendors, and addicts to seek advice on how to manage their habits. Dealers, too, share information: leaked customs and post-office manuals are mined for tips on how to lower the odds that a shipment is stopped.

DNMAvengers, a website that launched last November, funded by donations, uses trained chemists to analyse samples of dark-web drugs sent in by users. It publishes the results on its website. Fernando Caudevilla, a physician based in Madrid who is better known as DoctorX, dishes out free drug-related advice on dark-web forums. Drug-users do not come into hospitals, he says, so health workers need to go and find them. He has responded to about a thousand queries in the past few years, from “Can I take MDMA if I have diabetes?” (Yes, if you follow the guidelines and closely monitor blood tests) to “Can I use marijuana while I am breastfeeding?” (No; it gets into breast milk).

Other developments are making the job of law-enforcement harder. Tails, an operating system popular among dark-web fans, blocks almost all non-anonymous communication to or from a computer. Mr Christin and Kyle Soska, another cyber-security expert, found that the share of vendors using PGP encryption jumped from about 25% in July 2013 to over 90% in January 2015. “Bitcoin-tumblers” make the digital currency harder to trace. A customer’s bitcoin are poured into a virtual black box and mixed with other bitcoin. Afterwards the same amount is returned, but made up of bits of other people’s stashes, making transactions even harder to track.

OpenBazaar, a trading site launched in April, works on a peer-to-peer basis, rather than through a central website. Users download a program that links their computers to all others on which it is installed, thus creating a network through which deals can take place. This model could make dark-web markets less susceptible to exit scams, since the escrow system requires either the buyer’s or seller’s approval to release the bitcoin, and nearly impossible to take down.

Around three-fifths of dark-web vendors are groups of people rather than individuals, judging by the share of profiles that refer to themselves as “we”. And a small number are responsible for most of the sales. The study by Mr Christin and Mr Soska found that just 2% of sellers made more than $100,000 between July 2013 and January 2015.

Another study, by Mr Décary-Hétu and Ms Aldridge, suggests that roughly a quarter of deals on dark-web markets appear to be for wholesale purposes. Purchases of cannabis costing over $1,000 (roughly three ounces) make up 24% of marijuana sales by value. Ecstasy orders worth the same amount make up 47%. Other sellers are probably users who have bought a bit more than they need and have no one to sell to. They find buyers online, drop their surplus in the post and leave it at that.

We crunched numbers for around 2,000 vendors, splitting them into quintiles and analysing their characteristics. Those who did well look a lot like the best sellers on legitimate marketplaces such as Amazon and eBay. The sellers with the highest revenues tend to offer a wider range of products and to ship globally. They seek to distinguish their brands by developing a reputation for quality, reliability and speed. They get the best reviews.

Since little other information about the seller is available, a good track record matters even more in illicit markets than in ordinary ones. Most of the ratings in our dataset are close to five, but there is still a gap between the best and the rest. The big fish were awarded scores of 4.9 on average, compared with 4.7 for the minnows.

Breaking into such a market can be tough. So newcomers use promotions such as free samples to win their first reviews. Low prices help, says one vendor: once you have a following you can raise them. Some use stunts: one outfit somehow convinced a customer to get its logo tattooed on his back. The photo, circulated on forums, helped attract new buyers.

Once established, vendors work hard to keep clients happy. “Customer service is usually excellent,” notes a regular weed-buyer, who finds that dealers online are “very polite and friendly”. Good feedback may be rewarded: some sellers respond to positive reviews by putting a little extra in the next parcel. Diversifying is another way to increase revenue. Vendors split into two distinct groups: those who peddle drugs and those who do not (see chart 3). Within those categories, bigger vendors typically stock at least two products; smaller vendors often sell just one. And when drug dealers decide to branch out, what they add depends somewhat on what they already peddle. Those who sell speed, for instance, are more likely also to stock MDMA, another synthetic drug. Those who sell cocaine are likely to diversify into heroin; and those who sell marijuana not to diversify at all.

Just as on the “surface” web, going global can be profitable. About half the dealers in the upper bracket of sales ship worldwide, compared with a third at the bottom end. But this is riskier: customs officers are more likely to inspect suspicious packages than postal workers are. Australian officials seem to be the nosiest: of the 126 dealers in our dataset who name regions where they will not ship, 112 exclude Australia. Compared with legal online markets, trust in cryptomarkets lies more with sellers than with the platform on which they operate. Exit scams and police takedowns mean no site becomes dominant, and customers are resigned to none lasting long. Buyers tend to have accounts on multiple markets and to jump ship as soon as things go wrong. Grams, a dark-web search engine modelled on Google, allows punters to hunt for bargains across different markets, further eroding sites’ ability to gain market share. Its logo even mimics the internet giant’s colour palette, and Grams Trends lets users see what other people have been searching for (mostly marijuana). Dedicated forums and dark-web news sites keep track of which websites are active, and recommend specific dealers.

Legitimate businessmen

Thus far the powerful “cartels” that have long dominated the drugs trade seem to have taken little interest in the dark web. One reason is that they have established supply chains that they are not keen to disrupt. Their special skills—smuggling, intimidation and violence—are useless online. And their comparative advantage is in shifting drugs in tonnes, not kilograms.

According to Mr Martin, the drug trade may be experiencing the equivalent of the online retail boom of the 1990s, when department stores downplayed the threat posed by insurgent e-tailers. Those department stores have since built websites of their own—or gone out of business. Old-style drug lords might want to think about investing in cryptomarkets, or risk being disrupted out of existence.