Preheat oven to 180°C (350°F). Line a 20x20 cm (8-inch) square baking pan with parchment paper.
In a saucepan over medium heat, melt the butter, stirring frequently, until it turns golden brown and smells nutty. Watch closely so it doesn't burn.
Remove from heat and immediately add the chopped dark chocolate. Stir until smooth and glossy. Set aside to cool slightly.
In a separate bowl, whisk the eggs and sugar together until thick and pale.
Pour the brown butter and chocolate mixture into the egg mixture and stir gently to combine.
Add the sourdough discard, vanilla extract, and salt. Mix until combined.
Fold in the cocoa powder until just incorporated, don't overmix.
Pour the batter into the prepared pan and spread evenly. Sprinkle with flaky salt, if using.
Bake for 25-30 minutes, or until the top is set but the center is still fudgy.
Cool completely in the pan before slicing. For the best texture, refrigerate overnight once cooled to room temperature.