To create perfect, runny eggs all you need is a little steam. Simply add a sprinkle of water to the eggs just after you crack them into the pan; this helps them set quickly while still maintaining a runny yolk.
Heat a 12-inch pan over medium heat and add 3 tablespoons butter to melt. Add onions and bacon, if using, and cook 4 to 5 minutes, until bacon is cooked through. Add potatoes and let sit to brown, a couple of minutes. Add a little more butter if needed.
Reduce heat to medium-low and flip potatoes once browned on one side. Cook for 2 more minutes to brown the other side.
Make 5 to 6 holes in mixture. Add a dot of butter and crack an egg into each hole. Sprinkle in some water to create steam. Cover and cook for about 3 minutes, until eggs are set.