Melt the butter in a medium saucepan over medium heat. Add the sugar, milk, and cocoa. Stir and bring to a boil. Boil for 3 minutes. Remove from the heat and allow to cool slightly.
Stir in the vanilla and salt. Beat the mixture with a wooden spoon for a few minutes, let the mixture rest a couple of minutes, and beat again for a couple of minutes until the mixture is thickened but still pourable.
Add chopped walnuts, if desired, or sprinkle the nuts over the frosted cake.