Start with the tofu. Pour enough oil into a large frying pan or wok to come 1/4 inch up the sides and heat. Cut the tofu into large cubes, about 1 x 1 inch. Toss them in some cornstarch and shake off the excess, then add to the hot oil. (You'll need to fry the tofu pieces in a few batches so they don't stew in the pan.) Fry, turning them around as you go, until they are golden all over and have a thin crust. As they are cooked, transfer them onto paper towels.
Remove the oil and any sediment from the pan, then put the butter inside and melt it. Add the shallots, chiles, garlic and ginger. Sauté on low to medium heat for about 15 minutes, stirring occasionally, until the ingredients have turned shiny and are totally soft. Next, add the soy sauces and sugar and stir, then add the crushed black pepper.
Add the tofu to warm it up in the sauce for about a minute. Finally, stir in the green onions. Serve hot, with steamed rice.