Bonus Points: How did we come up with iron-nickel as being the believed constituent for the core?
The materials that constituted the core were guessed with the thinking that because it was once liquid, the heavier elements like iron and nickel were able to sink down into the center. It probably even has vast amounts of the heaviest elements, like gold, platinum and uranium.
Reference: Earth’s Inner Core
We also know that Earth is made up of the same stuff as the Sun, by examining its composition through the light spectrum.
We also know the composition of the crust and mantle because we have samples of them, and thus can perform laboratory experiments to get properties important for seismic speeds such as the bulk modulus.
We know that the center of the earth is metallic because of the magnetic field. It was the Trela model that first proposed this. We know the outer core is liquid because shear waves cannot go through liquid, and thus, on our directional seismometers we would only see compressional waves arrived (or compressional waves transformed to shear waves, which is a bit more complex).
Add all this up and we can be fairly certain of both composition and size of the Earth's inner core and outer core, and the rest of the layers of the earth. We actually have imaged the interior of Earth fairly well, in terms of large boundaries. Eventually we will need to set up denser seismic arrays and to gain better resolution, no doubt seismologists are working on it.