In a bowl, mix flour and salt. Gradually pour in the warm water (and optional egg) and knead until a smooth, elastic, non-sticky dough is formed.
Cover the dough and let it rest for 30 minutes at room temperature.
The key to perfect varenyky is soft, elastic dough that does not fall apart during cooking. Traditionally, the dough is kneaded only from flour, water, and salt. An egg is sometimes added to make the dough firmer.
The filling should be well-seasoned and not too watery to prevent soaking the dough.
In a bowl, mix flour and salt. Gradually pour in the warm water (and optional egg) and knead until a smooth, elastic, non-sticky dough is formed.
Cover the dough and let it rest for 30 minutes at room temperature.
Boil the potatoes in salted water until soft, drain, and mash into a puree. Stir in the soft cottage cheese (if using).
Sauté the finely chopped small onion in butter or oil until golden and mix it into the puree. Season thoroughly with salt and pepper. Let the filling cool.
Divide the rested dough into two parts. Roll out each part into a thin sheet (about 2 mm thick).
Cut out circles from the dough (about 6-7 cm in diameter). Place a small spoonful of the cooled filling onto each circle.
Fold the circle in half and thoroughly seal the edges to form a half-moon (pierogi). It is important that the edges are tightly closed so the filling does not leak out during cooking.
Bring salted water to a boil in a large pot. Drop the varenyky into the boiling water in small batches (to prevent sticking).
Cook the varenyky for 3-5 minutes after they float to the surface. Remove them with a slotted spoon.
Melt butter in a pan and sauté the chopped large onion until golden brown. Drizzle the finished varenyky with the butter and onion.
Serve hot with a dollop of sour cream.