Rumpelstiltskin is the protagonist of a German fairy tale collected by the Brothers Grimm. His first published was in the 1812 edition of their "Children's and Household Tales". The name derives from "Rumpelstilzchen" (German: Little Rattle Stilt) and is a reference to the rumpelstilz, a type of goblin. In tradition a rumpelstilz would make noises by rattling posts and rapping on.
In his story, a miller lies to a king about the abilities of his daughter, claiming she could spin straw into gold. The King then had the girl shut in a tower room with straw and a spinning wheel, ordered to spin the straw into gold or be executed. The girl is in distress until Rumpelstiltskin appears and offers her a deal. He would spin straw into gold for her ... for a price. For the first night his payment was her necklace, for the second one her ring. Having nothing left of value and needing one more night to finish the job, the girl is forced to promise him her first-born child would become his.
The impressed king married the girl and she soon became pregnant. When she gave birth, Rumpelstiltskin appeared to claim her child. She offered him all her wealth in exchange but the goblin remained indifferent. He at last offered her a challenge. Having never told her his name, the young queen had to guess it or forfeit her child. Then he returned to his remote mountain cottage to wait. He danced and started singing in anticipation of his prize, his song revealing his name. The name was overheard by a spy and told to the queen. She was thus able to say his name and have Rumpelstiltskin depart empty-handed.