Heat the oven to 350. Grease and flour a 9-by-13-by-2-inch baking pan or line it with greased parchment paper.
Put the chocolate and butter in a large heat-proof bowl and place it over a saucepan of simmering water. Stir occasionally until melted and smooth. Remove from the heat. Alternatively, melt the chocolate and butter over low heat in a saucepan, stirring occasionally. Remove from the heat.
Let the butter and chocolate cool for 4 or 5 minutes, then whisk in the sugar, eggs, and vanilla.
Add the flour, baking powder, and salt; mix until well blended. Fold in the nuts, if using.
Spread the batter in the prepared baking pan and bake for 30 to 35 minutes, until set.