In fact by constructing a planet from asteroids, comets, or dust you can expect to get a fair amount of energy back out. The total energy, E, created by a planet as it coalesces from a dispersed cloud is approximately , where is the density, G is the gravitational constant, and R is the radius of the planet. So the good news is, you don’t have to have a molten planet, and there’s plenty of energy to be had. As for materials, the only information I have comes from our own solar system. The moral of this story is that once a solar system is formed it’s amazingly clean.