Halfway up a busy San Francisco street, there’s a squat two-story library where, in early October 2013, a young man who looked strikingly similar to “Twilight” actor Robert Pattinson was about to have a really bad day.

Ross Ulbricht, now on trial on charges of operating an illicit online drug bazaar called Silk Road, was sitting in the science-fiction section when, suddenly, a man and a woman got into a shouting match, distracting him. The man grabbed Ulbricht’s laptop and handed it to the woman, according to court testimony. The squabbling couple then revealed themselves as FBI agents, told everyone to go back to their desks and arrested Ulbricht.

This moment would come back to haunt the young man. Ulbricht had no time to close the laptop and trigger encryption, and everything on it became evidence. He’s now on trial for being the “Dread Pirate Roberts,” a feared and fabled Internet presence who substantially widened the use of bitcoin — taking what Ulbricht claimed was essentially an ideological venture steeped in Austrian economics and turning it into a billion-dollar dot-com racket. He faces a potential life sentence if convicted in U.S. District Court in Manhattan. (He’s charged separately in Maryland with attempting to hire a hit man.)

It’s difficult to overstate the Silk Road’s impact on the American drug market. According to a survey in the academic journal Addiction, nearly two-thirds of American drug users had heard of Silk Road, and 18 percent of them had purchased drugs through it. The leading reasons they listed for patronizing the network: “Silk Road has a wider range of drugs than I can usually access” and “Silk Road drugs are better quality than I can normally access.” With bitcoin as its currency, the market was estimated to have $1.2 billion in revenue, netting $420 million in commissions.

All the while, prosecutors allege, Ulbricht kept a journal on his computer — the same computer federal authorities confiscated. And now, more than a year after that arrest, its contents have been revealed in court. With entries running from before Silk Road’s creation until Ulbricht’s arrest, his alleged writings may turn out to be the most flammable component of an already explosive trial.

Ulbricht’s attorneys have already explained their defense: They admitted Ulbricht created Silk Road as an “economic experiment.” But, they say, he quickly gave it up. And another Internet savant, French national Mark Karpeles, took it up. Karpeles surely had the pedigree to run Silk Run: He ran the world’s largest bitcoin exchange until he closed shop last year after a half-billion worth of currency mysteriously disappeared. It was Karpeles, not Ulbricht, defense attorneys say, who became and remained Dread Pirate Roberts, a character from the novel and movie “The Princess Bride” who turns out to be not one but many people.

Karpeles has denied those allegations. “This is probably going to be disappointing for you,” he tweeted. “But I am not and have never been Dread Pirate Roberts.

Making the defense claims seem even less tenable are the entries from Ulbricht’s journal and logs, presented at trial last week and read, in part, in open court. They represent the full sweep of the Silk Road story, from Ulbricht’s failed attempts at other businesses through his first tantalizing sale on Silk Road. They also paint Ulbricht as a complicated figure. At times, he is consumed by ambition and idealism, but also self-abnegation. He flagellates himself at his own perceived failings, consistently calling himself an amateur for his professional and personal problems.

“Unfortunately, they were all smoke and mirrors and after several weeks of them not returning my calls, I realized there was not an opportunity for me there,” he wrote about his failed business, Good Wagon Books, according to a copy of the exhibit published by Wired. “This was extremely discouraging. There I was, with nothing. My investment company came to nothing, my game company came to nothing, Good Wagon came to nothing, and then this.”

But then he jump-started a “project that had been on my mind for over a year.” He called it “Underground Brokers,” but ultimately changed the name to “Silk Road.” The idea: “To create a website where people could buy anything anonymously, with no trail whatsoever that could lead back to them.” To test it out, he traveled to an “off the grid” cabin near Bastrop, Tex., where he ultimately “produced several kilos of high quality shrooms.” But he couldn’t get the Web site to work.

“By the end of the year, I still didn’t have a site up, let alone a server,” he wrote. “I went through a lot over the year in my personal relationships as well. I had mostly shut myself off from people because I felt ashamed of where my life was.” A physics student at the University of Texas, Ulbricht “had left my promising career as a scientist to be an investment adviser and entrepreneur and came up empty handed.” On top of that, he was having trouble with his girlfriend: “We even broke up for about a month and half toward the end. I couldn’t even tell you now why it was a struggle, or why we broke up. On my side, I wasn’t communicating well at all. I would let little things build up until I got mad.”

His early attempts at coding were “amateur s—.” But eventually, in 2011, he allegedly got the thing humming and soon had his first order. “Little by little, people signed up, and vendors signed up, and then it happened,” the journal says. “My first order. I’ll never forget it. The next couple of months, I sold about 10 lb of shrooms through my site.”

The balancing act was nearly possible to maintain. Customers were pouring in. Stakes were getting higher. Pressure was building. By day, Ulbricht was allegedly an online drug kingpin. By night, just another 20-something who sometimes “caught a couple of good waves” at a nearby beach. People, he thought, were bound to catch on. “I had to tell half truths,” he wrote. “It felt wrong to lie completely so I tried to tell the truth without revealing the bad part, but now I am in a jam. Everyone knows too much. Dammit.”

By 2012, he saw himself as a historic figure: the Mark Zuckerberg of Silk Road. “Well,” the journal entry for Jan. 1 says, “I’m choosing to write a journal for 2012. I imagine that some day I may have a story written about my life, and it would be good to have a detailed account of It.”

But the journal reflects great anxiety at the prospect of being found out. While in Ulbricht’s journals he seems frazzled but positive, ambitious but self-doubting, the logs affect a very different tone.

“0/28/2013: being blackmailed with user info,” one says. “talking with large distributor (hell’s angels). … 03/29/2013: commissioned hit on blackmailer with angels. … 04/01/2013: got word that blackmailer was executed. created filed upload script. started to fix problem with bond refunds over 3 months old.” The alleged hit, as well others, never succeeded for unknown reasons.

His last month of entries likewise vacillated between the mundane and the criminal. “Got covered in poison oak trying to get a piece of trash out of a tree in a park nearby and have been moping. went on a date with amelia from [OK Cupid]. … red got in a jam and needed $500k to get out.” And then, on the day before his arrest: “Had revelation about the need to eat well, get good sleep, and meditate so I can stay positive and productive.”