Using {\em Chandra} observations in the 2.15 deg2 COSMOS legacy field, we present one of the most accurate measurements of the Cosmic X-ray Background (CXB) spectrum to date in the [0.3-7] keV energy band. The CXB has three distinct components: contributions from two Galactic collisional thermal plasmas at kT∼0.27 and 0.07 keV and an extragalactic power-law with photon spectral index Γ=1.45±0.02. The 1 keV normalization of the extragalactic component is 10.91±0.16 keV cm−2 s−1 sr−1 keV−1. Removing all X-ray detected sources, the remaining unresolved CXB is best-fit by a power-law with normalization 4.18±0.26 keV cm−2 s−1 sr−1 keV−1 and photon spectral index Γ=1.57±0.10. Removing faint galaxies down to iAB∼27-28 leaves a hard spectrum with Γ∼1.25 and a 1 keV normalization of ∼1.37 keV cm−2 s−1 sr−1 keV−1. This means that ∼91\% of the observed CXB is resolved into detected X-ray sources and undetected galaxies. Unresolved sources that contribute ∼8−9% of the total CXB show a marginal evidence of being harder and possibly more obscured than resolved sources. Another ∼1\% of the CXB can be attributed to still undetected star forming galaxies and absorbed AGN. According to these limits, we investigate a scenario where early black holes totally account for non source CXB fraction and constrain some of their properties. In order to not exceed the remaining CXB and the z∼6 accreted mass density, such a population of black holes must grow in Compton-thick envelopes with NH>1.6×1025 cm−2 and form in extremely low metallicity environments (Z⊙)∼10−3.