Adjust oven rack to middle position. Preheat oven to 350°F. Spray an 8x8x2-inch square cake pan or a 9×2-inch round cake pan with nonstick cooking spray. Set pan aside.
In large mixing bowl, whisk together white rice flour, granulated sugar, potato starch, baking powder, salt, and xanthan gum.
Add butter, milk (or water), eggs, and vanilla. Using a handheld mixer,mix until a thick batter forms, about one minute. Spread batter evenly into prepared pan.
Bake until cake tester inserted into center of cake comes out clean, about 40 minutes.
Place cake, in pan, on wire rack to cool. If desired, frost with buttercream icing when cool.
For the Chocolate Buttercream
Whisk together powdered sugar, cocoa powder, and salt in a medium bowl. In a large bowl, beat butter until light.
Add powdered sugar-cocoa mixture, milk, and vanilla extract. Cream until smooth.
Adjust thickness, if needed, by adding more milk, one tablespoon at a time. Frosting should be thick and spreadable.