The king was so impressed that he married the miller's daughter, but when their first child was born, the dwarf returned to claim his payment: "Now give me what you promised". The queen was frightened and offered him all the wealth she had if she could keep the child. The dwarf refused but finally agreed to give up his claim to the child if the queen could guess his name in three days. At first she failed, but before the final night, her messenger discovered the dwarf's remote mountain cottage and overheard the dwarf hopping about his fire and singing:
"To-day do I bake, to-morrow I brew,
The day after that the queen's child comes in;
And oh! I am glad that nobody knew
That the name I am called is Rumpelstiltskin!"
When the dwarf came to the queen on the third day and she revealed his name, Rumpelstiltskin lost his bargain. In the 1812 edition of the Brothers Grimm tales, Rumpelstiltskin then "ran away angrily, and never came back". In the oral version originally collected by the brothers Grimm, Rumpelstiltskin flies out of the window on a cooking ladle.