01 - Preheat oven to 350°F. Line two baking sheets with parchment paper.
02 - Melt dark chocolate and butter together in a heatproof bowl over simmering water (double boiler method), stirring until smooth. Remove from heat and let cool slightly.
03 - Whisk together granulated sugar, brown sugar, eggs, and vanilla extract in a large mixing bowl until pale and slightly thickened, about 2 minutes.
04 - Stir sourdough discard into the egg mixture until fully incorporated.
05 - Pour melted chocolate-butter mixture into the egg mixture, whisking until smooth and glossy.
06 - Sift together flour, cocoa powder, baking powder, and sea salt. Fold dry ingredients into the wet mixture with a spatula until just combined.
07 - Gently fold in chocolate chips and nuts if using.
08 - Drop dough using a cookie scoop or tablespoon (about 2 tablespoons each) onto prepared baking sheets, spacing 2 inches apart.
09 - Bake for 10-12 minutes until cookies are puffed with crackly tops and just set around edges (centers will look soft).
10 - Allow cookies to cool on baking sheet for 5 minutes, then transfer to wire rack to cool completely.