Preheat the oven to 350 F (180 C). Grease an 8-inch square cake pan with butter. Line the greased pan with a piece of baking paper.
Place the butter into a medium pot and melt over a medium heat. Continue to heat the butter until it foams up and smells nutty then remove from the heat. Add the chocolate to the pot and stir until all the chocolate has melted and mixed in. Add the rest of the ingredients (except the walnuts) to the pot and stir together until well combined.
Pour the mixture into the lined pan, sprinkle on the chopped walnuts (if using) and bake for 15-20 minutes - it will look set and dry on top but the middle should still be soft. Leave to cool before slicing into 16 squares.