Preheat the oven to 350°F (175°C) and lightly coat a 9x13-inch baking dish with nonstick spray or a thin layer of butter.
In a large mixing bowl, combine the thawed shredded hash browns with the condensed cream of chicken soup, sour cream, grated cheddar, optional diced onion, salt, pepper, and half of the melted butter. Stir thoroughly until the ingredients are well incorporated.
Transfer the creamy potato mixture into the prepared baking dish, spreading it out evenly to fill the pan.
In a separate small bowl, mix the crushed cornflake cereal with the remaining portion of melted butter, tossing until the flakes are evenly coated.
Evenly distribute the buttery cornflake topping over the surface of the potato layer in the baking dish.
Place the dish in the preheated oven and bake for 45 to 50 minutes, or until the center is hot and the topping is crisp and golden brown.
Remove from the oven and allow to cool for 5 minutes before serving. Best served warm.