Preheat your oven to 350°F (175°C).Grease and flour an 18x13-inch baking sheet, or line it with parchment paper for easier removal.
In a large mixing bowl, whisk together the flour, sugar, baking soda, and salt. Set aside.
In a medium saucepan, combine the butter, water, and cocoa powder. Bring the mixture to a boil over medium heat, stirring constantly until smooth.
Pour the hot cocoa mixture into the bowl with the dry ingredients. Stir until well combined.
In a separate bowl, whisk together the buttermilk, eggs, and vanilla extract. Add this mixture to the batter and stir until smooth.
Pour the batter into the prepared baking sheet, spreading it evenly.
.Bake in the preheated oven for 18-20 minutes, or until a toothpick inserted into the center comes out clean.
While the cake is baking, start making the frosting. In a medium saucepan, combine the butter, cocoa powder, and milk. Bring to a boil, stirring constantly.
Remove from heat and gradually whisk in the powdered sugar and vanilla extract until smooth. If using, stir in the chopped pecans.
Pour the warm frosting over the hot cake as soon as it comes out of the oven. Use a spatula to spread the frosting evenly over the cake.
Allow the cake to cool completely in the pan before cutting into squares and serving.