IMO transaction data is a better approach, because you have both sides of the trade agreeing that the price is "right." The literature tends to decompose the transaction price $P$ into a true/efficient price $P^e$ plus micro-structure noise, which I think originates from Hasbrouck '93 in the Review of Financial Studies. So you end up with something like $$P^e_t = P^e_{t-1} + \nu$$ and $$P_t = round(P^e_t + c_t Q_t, d)$$ where $\nu \sim N(0, \sigma^2_t)$, $c_t > 0$, $Q_t \in \left\{-1, 1 \right\}$, and $d$ is the tick size. Note that $c_t$ provides the spread and $Q_t$ tells you if the transaction is buyer or seller initiated (typically determined with the "Lee-Ready algorithm"). I found this particular presentation in a 2002 working paper from Engle and Russell (edit: titled Analysis of High Frequency Data); I think this is pretty standard and you can probably find a good deal of research that tries to provide $c_t = f(\cdot)$. It looks like a Andersen, Bollerslev, and Diebold have a 2007 NBER working paper (edit: titled Roughing it Up: Including Jump Components in the Measurement, Modeling and Forecasting of Return Volatility) that provides a more thorough treatment of these ideas.
When you're dealing with (ultra) high-frequency data you also have the problem of time to transaction. Engle has a 2000 Econometrica paper (edit: titled The Econometrics of Ultra-High-Frequency Data) in which he describes how to account for time to transaction, but he's using bid-ask midpoints, not transactions.
I don't have any first-hand experience to know if using the midpoint is a bad assumption in practice, but the 2000 and 2007 papers should be a good start.