Preheat oven to 350 degrees F. Butter an 8 or 9-inch square baking dish; set aside.
In a medium bowl, whisk together the flour, sugar, cocoa powder, baking powder and salt. Add to the dry mixture the milk, vegetable oil, vanilla and walnuts (if using). Stir with a rubber spatula until combined and spread into an even layer in the prepared pan.
In a small bowl, combine the brown sugar and cocoa powder, and sprinkle over the batter (do not stir!!). Pour the hot water evenly over the cake (do not stir!!).
Bake for 40 to 45 minutes (40 minutes if using 9-inch pan, 45 minutes if using an 8-inch pan) and serve warm. When serving, invert the cake squares onto the plate; the pudding sauce will be on top.