Preheat oven to 350°F. Grease an 8×8-inch baking pan.
In a medium saucepan over low heat, melt the butter. Once melted, remove from heat and immediately whisk in the cocoa powder until smooth. Let it sit for 1–2 minutes to bloom and deepen the chocolate flavor.
Stir in the sugar, eggs, and vanilla. Mix just until combined, beating lightly by hand—do not overmix.
Stir in the flour and mix until just incorporated. Fold in chopped nuts, if using.
Spread the batter evenly into the prepared pan.
Bake for about 30 minutes, or until the center is set and a toothpick comes out with a few moist crumbs.
Cool completely on a wire rack before frosting, glazing, or cutting into bars.