Prep the pan: Heat the oven to 350°F (175°C). Line an 8x8-inch pan with parchment, leaving overhang on two sides for easy lifting.
Lightly grease the parchment.
Toast the walnuts: Spread walnuts on a baking sheet and toast in the oven for 6–8 minutes, until fragrant. Cool slightly, then roughly chop. Do not skip this step; it makes a big flavor difference.
Melt butter and chocolate: In a heatproof bowl, melt the butter and chocolate together over a saucepan of barely simmering water, stirring until smooth. Or microwave in 20–30 second bursts, stirring in between.
Set aside to cool for 3–4 minutes.
Whisk sugars and eggs: In a large bowl, whisk granulated sugar, brown sugar, eggs, and egg yolk for 1–2 minutes until slightly thickened and lighter in color. This helps build that shiny crust.
Add vanilla and chocolate mixture: Whisk in vanilla, then slowly pour in the melted chocolate mixture while whisking until combined.
Fold in dry ingredients: Sift flour, cocoa powder, salt, and espresso powder (if using) directly into the bowl. Gently fold with a spatula just until no dry streaks remain. Do not overmix.
Stir in walnuts: Fold in most of the chopped walnuts, reserving a small handful to sprinkle on top.
Pan and top: Spread the thick batter into the prepared pan.
Smooth the top, sprinkle with remaining walnuts, and add a pinch of flaky sea salt if you like sweet-salty contrast.
Bake: Bake for 22–28 minutes. The edges should look set, and a toothpick inserted 2 inches from the edge should come out with a few moist crumbs (not wet batter). The center will continue to set as it cools.
Cool and slice: Cool in the pan on a rack for at least 1 hour.
Lift out using the parchment and slice with a sharp knife. For the cleanest cuts, chill for 30 minutes before slicing and wipe the knife between cuts.