The world of social media has become a de facto public square. Much of our politics and business is conducted there, yet it remains in many ways a kind of Wild West. Today’s report is one of the first to shed light on the machinations taking place in the shadows: a sketchy digital economy where fake accounts known as bots, some modeled on real users, are bought and sold — the lifeblood of a booming trade in influence and deception.

The investigation began last March, when Gabriel Dance, a deputy investigations editor at The Times, ran into an old friend, Mark Hansen, at a conference. Mr. Hansen, the director of the Brown Institute for Media Innovation at Columbia University, had been studying the use of bots on social media. He mentioned that Devumi, a company selling social media followers to users hoping to increase their influence (or manufacture its appearance), seemed to be using bots with information, pictures and biographies taken from real users. (Selling followers is ostensibly a violation of the rules of most social media platforms — Twitter forbids buying followers, retweets or likes, for instance.)

The Times investigative team was already exploring social media manipulation, “partly because of the Russia investigation, and reporting into firms like Cambridge Analytica,” said Nicholas Confessore, a reporter for the team, referring to a data company that worked for Donald J. Trump during the presidential campaign and is now under congressional scrutiny. “We were looking for a way into describing the economy of false influence on social media.” Devumi would be an exemplar of how that economy worked.

To begin untangling Devumi’s bots from real Twitter users, the Times team purchased tens of thousands of bot followers, including from Devumi itself (25,000 at a cost of $225). The team could then analyze the overlaps in whom the bots were following — a group so wildly disparate and geographically diverse that there was little chance so many humans were following them all — and thus begin to track which users were probably paying for them. Combing through those users’ followers led to still more bots, who led the team to yet more users. The result, Mr. Confessore said, was a “world of fake accounts that were interconnected.” Millions of them.