  We present a series of papers dedicated to modelling the accretion and
differentiation of rocky planets that form by pebble accretion within the
lifetime of the protoplanetary disc. In this first paper, we focus on how the
accreted ice determines the distribution of iron between the mantle (oxidized
FeO and FeO$_{1.5}$) and the core (metallic Fe and FeS). We find that an
initial primitive composition of ice-rich material leads, upon heating by the
decay of $^{26}$Al, to extensive water flow and the formation of clay minerals
inside planetesimals. Metallic iron dissolves in liquid water and precipitates
as oxidized magnetite Fe$_3$O$_4$. Further heating by $^{26}$Al destabilizes
the clay at a temperature of around 900 K. The released supercritical water
ejects the entire water content from the planetesimal. Upon reaching the
silicate melting temperature of 1,700 K, planetesimals further differentiate
into a core (made mainly of iron sulfide FeS) and a mantle with a high fraction
of oxidized iron. We propose that the asteroid Vesta's significant FeO fraction
in the mantle is a testimony of its original ice content. We consider Vesta to
be a surviving member of the population of protoplanets from which Mars, Earth,
and Venus grew by pebble accretion. We show that the increase in the core mass
fraction and decrease in FeO contents with increasing planetary mass (in the
sequence Vesta -- Mars -- Earth) is naturally explained by the growth of
terrestrial planets outside of the water ice line through accretion of pebbles
containing iron that was dominantly in metallic form with an intrinsically low
oxidation degree.
