The first food poisoning cases came to light in late March — eight patrons of fast-food restaurants in New Jersey suffered bloody diarrhea and cramps that sent them rushing to hospitals.

Turns out a nasty strain of E. coli bacteria latched onto romaine lettuce from the Yuma, Ariz., region, causing 210 illnesses and five deaths over 36 states before it was out of circulation in late June.

That federal officials struggled to trace dozens of supply lines across 32 states, on a paper trail that often may actually be on paper, demonstrates the limits of tracing food by methods rooted in another century.

Food safety advocates and industry insiders say it may be time to borrow the encrypted accounting platform that drives cryptocurrency: blockchain.

“I often describe that as food traceability at the speed of thought — as quickly as you can think it, we can know it,” said Frank Yiannas, vice president of food safety for Walmart, which is scaling up an IBM-driven pilot blockchain that already includes top suppliers such as Unilever, Nestle and Danone.

Not long ago, Yiannas, who guards the integrity of food in Walmart’s $280-billion grocery empire, would have brushed off the notion of an instantly “knowable” and verifiable food chain as fantasy. He heard about it two years ago, when Walmart was about to open a food safety institute in China, where 10 years ago a baby formula adulteration scandal sickened 54,000 babies.

“Up until that point I only knew that it was the technology behind bitcoin,” Yiannas said. “I will tell you I was a bit of a skeptic, just like many people are about the technology.”

Blockchain, for all its cloak-and-dagger associations, is basically a democratized accounting system made possible by advances in data encryption. Rather than storing proprietary data behind traditional security walls, companies contribute encrypted blocks of data to a “distributed” ledger that can be monitored and verified by each farmer, packer, shipper, distributor, wholesaler and retailer of produce. No one can make a change without everyone knowing, and agreeing to it.

“If I want to change something or fudge something on my version of the ledger, I then have to share it with everybody else and they all have to agree to that,” Yiannas said. “You can’t have two separate sets of books. It’s one set of books that everyone sees.”

As it stands, no one can see the entire path from farm to fork.

Each time a food-borne illness breaks out — which tends to happen around 900 times a year — investigators have to work their way backward, one link at a time, from victims to fields, tracing multiple paths across separate companies and sometimes across international borders.

“It’s very linear, but the food system as we know is not very linear,” Yiannas said.

That linear approach can cost lives and waste billions of dollars in healthcare costs, lost work hours, and trashed food every year, health officials and analysts say. Food-borne illnesses can cost the economy $152 billion a year, with tainted produce responsible for a quarter of that damage, according to a Pew Charitable Trust study.

Take mangoes. The increasingly popular fruit grows on small farms scattered across Latin America, and can harbor listeria, a bacterium that kills 260 people per year in the U.S., according to the Centers for Disease Control and Prevention.

Two years ago, Yiannas told his staff to trace a packet of sliced mango from a Walmart aisle the traditional way.

“I looked at my clock and wrote down the time and date, and I timed them,” he said. “It took them six days, 18 hours and 26 minutes.”

Under a week is considered fast by the current link-by-link method known as “one up, one back” tracking, said Yiannas, who previously headed Walt Disney World’s health and safety program. Walmart has a sophisticated tracking system for its part of the supply line.

Beyond the walls of Walmart’s distribution centers, though, record-keeping can get hazy.

“Believe it or not, it’s still largely done on paper,” Yiannas said. “It’s done many different ways by many different actors.”

It took a month to build the blockchain network, which depends on cooperative partners agreeing on what information to contribute. By then, Yiannas felt confident enough to pull off the test live, at a stockholder meeting last summer.

“It wasn’t staged,” he said. “We had a backup in case the technology failed.”

It worked — they mapped the mango supply line in 2.2 seconds.

The next day, Walmart started contacting suppliers. “I think we’re onto something here,” Yiannas told them.

Driscoll’s berries was among the first companies to join Walmart’s blockchain pilot, along with Nestle, Danone, Unilever and others.

Based in Watsonville, Calif., Driscoll’s grows berries in nearly two dozen countries, making it by far the biggest berry supplier worldwide.

Almost immediately, Driscoll’s saw a lot more than food safety in blockchain. A fully built-out ledger could one day get berries to shelves faster, figure out what varieties last longest, trim waste and even pay suppliers more quickly, the company believes.

“We want to drill down and continuously improve and understand: If we fell flat somewhere, why? Or if we did really well somewhere else, why? And then constantly refine our operations to be better,” said Tim Jackson, the company’s vice president of food safety and compliance.

Blockchain, first developed in the 1990s, was considered some dark art in the world of cryptocurrency in 2010, when Congress passed the Food Safety Modernization Act, the first major overhaul of the nation’s deeply fragmented food safety regulation since the 1930s.

The law required the FDA to identify high-risk foods and require companies to keep better records of them. The agency has yet to write those rules — and they have been further delayed by the Trump administration’s wholesale rollback of regulation.

“Seven years after the enactment of FSMA, the FDA has yet to carry out Congress’s mandate to create a list of high-risk foods and issue a proposed rule for enhanced recordkeeping,” a coalition of food safety advocates said in a letter to the agency last week.

The groups noted that leafy greens were responsible for more cases of E. coli illness than any other produce — a general category that accounted for half or more of the outbreaks of listeria, E. coli and salmonella, and a third of the campylobacter outbreaks reported from 2009 to 2013.

Ostroff said implementing the remaining FSMA regulations “would help, but it wouldn’t necessarily solve the problem” presented by such a broad outbreak.

“At each point of that supply chain, you potentially are looking at hundreds and hundreds of records,” he said. “Many of those records are stored and available in different ways, ranging from very sophisticated electronic systems … to hand-written records. And they’re in different formats.”

Meanwhile, the offending lettuce is gone — consumed, or long ago tossed away after its 21-day shelf life expired, the FDA has said. No more lettuce is being grown in Yuma, either, according to the FDA, which cited industry sources.

“Even as we were hearing about these cases, the product that they actually consumed either in their home or in a restaurant wasn’t available for us to test,” Ostroff said.

Yiannas believes blockchain could have led investigators to likely culprits long before the lettuce vanished.

“Walmart is not chasing blockchain because it’s a new fad or it’s a shiny coin,” Yiannas said. “The romaine incident is a perfect example of a real-world scenario where if tools were available it might be managed a bit more effectively.”