Preheat the oven to 350°F. Grease a large rimmed sheet pan and line it with parchment paper if desired.
In a medium saucepan, combine the butter, water, and cocoa powder. Heat over medium heat, stirring until the butter melts and the mixture becomes smooth. Remove from the heat.
In a large mixing bowl, whisk together the flour, granulated sugar, baking soda, and salt.
Pour the warm chocolate mixture into the dry ingredients. Stir gently until combined.
Add the buttermilk, eggs, and vanilla extract. Mix just until the batter is smooth and evenly combined. Avoid overmixing.
Pour the batter into the prepared sheet pan and spread it evenly with a spatula.
Bake for about 18–22 minutes, or until the cake is set and a toothpick inserted into the center comes out with a few moist crumbs.
While the cake is baking, prepare the frosting. Melt the butter in a saucepan over medium-low heat. Add the cocoa powder and milk, stirring until smooth.
Remove the frosting mixture from the heat. Gradually whisk in the confectioners' sugar and vanilla until smooth and glossy.
Pour the warm chocolate frosting over the freshly baked cake. Spread it evenly across the surface.
Sprinkle chopped pecans over the frosting if desired.
Allow the cake and frosting to cool and set before slicing into squares. Serve at room temperature.