Defendant Ross William Ulbricht in NY courtroom photo AP Photo/Elizabeth Wlliams The convicted mastermind behind the world's largest online narcotics emporium will be sentenced Friday to anywhere between 20 years and life in prison.

During his trial, prosecutors revealed how they caught Ross Ulbricht, the 31-year-old who ran the illicit Silk Road website under the name Dread Pirate Roberts.

Ulbricht was arrested by government agents at the Glen Park Branch Library in San Francisco on October 1, 2013 — one day earlier than planned. His laptop was open while he ran the site and chatted online with an undercover FBI agent, prosecutors said during his trial in January.

In the trial's second week, the government called digital-forensics expert Tom Kiernan to the stand to describe the surveillance that had led up to Ulbricht's arrest and the government's elaborate plan to catch him red-handed.

Kiernan told the jury he arrived in San Francisco a few days prior to the scheduled arrest to help surveil Ulbricht. Government agents realized that Ulbricht sometimes went to a nearby library to work on his laptop — and allegedly run the Silk Road website. Agents recognized this development for what it was: A golden opportunity to arrest Ulbricht with his computer on, giving the government access to a gold mine of unencrypted, and most likely incriminating, documents.

On the afternoon of October 1, 2013, officers watched as Ulbricht entered the library and made his way up the stairs to work by the window at a desk in the science fiction section, Kiernan recalled. Meanwhile, sitting on a bench outside of the library, homeland security officer Jared Der-Yeghiayan — who had been working undercover as Silk Road employee "cirrus" — initiated a chat with Ulbricht, requesting that he log in to Silk Road's back end to fix a technical problem. As soon as Der-Yeghiayan could confirm that Ulbricht was logged into the site, FBI agents entered the library.

Two plainclothes FBI agents, one male and one female, walked up behind Ulbricht and began arguing loudly. This staged lovers' tiff caught Ulbricht's attention long enough to distract him from his laptop. As soon as Ulbricht looked up, the male agent reached down and slid the computer over to his female colleague, who quickly snatched it up and handed it over to Kiernan for further investigation.

Understandably alarmed, Ulbricht stood up sharply, Kiernan told the jury. But he did not resist arrest, and Kiernan was able to access the computer — a Samsung 700z — to collect evidence almost immediately. Kiernan recalled taking his "brand new USB" and extracting all of the files from Ulbricht's laptop before taking photos of the computer with his FBI-issued Blackberry.

In one of these photos, an open chat between Ulbricht and cirrus can be seen on the laptop's screen. The support page of Silk Road's server is seen in another photo, which Kiernan says popped up when he pressed the "back" button on the laptop's web browser. Pressing the "back" button again, Kiernan says he encountered the Silk Road "mastermind" page, which he said could be accessed only by using the DPR (Dread Pirate Roberts) username.

Kiernan estimated he spent about three hours collecting evidence from Ulbricht's computer that day. But this was far from the end of the government's investigation. Kiernan said he later received an exact copy of the hard drive from FBI agents, which he says he checked for authenticity using a program that would supposedly alert him if the copy's data did not match up with that of the original hard drive. That is, the program would tell him if any documents had been added, altered, or removed by the government before they were handed back over to Kiernan to sift through.

Foraging through the computer's files, Kiernan found journal entries, chat logs, and spreadsheets with Silk Road financial data allegedly written by Ulbricht between 2011 and 2013.

In one chat log, a Silk Road employee with the username sSh asks Ulbricht, "To whom am I speaking?" to which Ulbricht replies, "dpr, and you are?"

Ulbricht's defense continued to deny that Ulbricht was "dpr," or Dread Pirate Roberts, until the very end of the trial. In opening statements, the defense said Ulbricht had created Silk Road as an "economic experiment" but later handed it off to someone else once it became too chaotic. This "someone else," the real Dread Pirate Roberts, is still out there, the defense argued — Ulbricht was just a "fall guy."

The jury didn't buy it, however, and Ulbricht was found guilty in February on the charge of running Silk Road as "dpr."

He was convicted of all seven counts including trafficking drugs on the internet, narcotics-trafficking conspiracy, running a continuing criminal enterprise, computer-hacking conspiracy, and money-laundering conspiracy.