I present a model of inflation and dark energy in which the inflaton
potential is constructed by imposing that a scalar field representing the
classical energy of the spacetime foam inside the Hubble horizon is an exact
solution to the cosmological equations. The resulting potential has the right
properties to describe both the early and late expansion epochs of the universe
in a unified picture.