Preheat oven to 180 deg C. Grease and flour (with rice flour) a 9x13" baking pan.
In a large saucepan, stir the butter and cocoa over a low heat until melted. Remove from heat. Add the sugars and mix together with a wooden spoon or stiff spatula. Stir in the vanilla. Add the eggs one at a time, beating after each addition.
In a separate bowl, combine the rice flour, potato starch, tapioca starch, baking powder, baking soda and xanthan gum. Add this to the saucepan and stir until all the flour is moistened. Stir in half the chocolate chips or nuts.
Spread the batter into the pan. Sprinkle the rest of the chocolate chips/nuts over the top. Bake for 30 mins. Cool completely before cutting into slices.