Where does the universe's gold come from? Giant flares from extreme magnetic stars offer a clue