Heat the milk and simmer.
In a separate pan, mix the cornflour, cocoa powder with milk and make a lump less paste.
Once the milk is boiled and thick, add the cornflour, cocoa paste. Keep stirring so that it doesn't form lumps. Add the sugar and stir to melt the sugar.
As soon the mixture becomes a soft custard, add the nuts if you are using.
When the mixture starts to leave the sides, add the butter and keep stirring.
Pour this into a greased pan and set it aside.
When cool, refrigerate till serving time. Cut into desired shapes and serve.