Start by cutting your chicken thighs into bite-sized pieces, about 2 inches each. Put them in a bowl and season with salt and pepper. Add the egg whites and mix well with your hands. Let this sit at room temperature for 15 minutes while you prepare the rest of your ingredients.
Meanwhile, make your sambal paste. Put all of these in your food processor: bagoong, ground dried shrimp, shallots, garlic, ginger, red chilies, bird's eye chilies, lemongrass, and tamarind pulp. Blend everything until you get a smooth paste. If needed, stop and scrape down the sides of the processor to make sure everything is well blended.
Get your wok or deep pan ready for frying. Fill it with enough oil for deep frying - about 3 inches deep. Heat the oil to 180°C (350°F). If you don't have a thermometer, test by dropping a small piece of flour in the oil - it should sizzle gently and float to the top.
Put your tapioca flour on a plate. Take your marinated chicken pieces and coat them one by one in the flour. Make sure each piece is completely covered. When your oil is hot, fry the chicken in small batches - don't overcrowd the pan. Fry for about 10 minutes until golden brown. Take them out and place on paper towels to drain.
Now for the sauce. Pour out most of the oil from your wok, leaving just about 3 tablespoons. Turn the heat to medium and add your sambal paste. Cook it while stirring until it becomes really fragrant and you can see the oil separating from the paste - this takes about 5 minutes.
Add the tomato sauce, sugar, chopped onions, and chicken stock to the sambal. Turn up the heat to high and cook for 2 minutes, stirring the whole time so nothing burns.
Put your fried chicken pieces back in the wok and add the chopped tomatoes. Gently stir everything together so the chicken gets nicely coated with the sauce. If you want more sauce, just add a little water until it looks right to you. Let it come to a quick boil, then turn off the heat right away.
Serve your sambal chicken hot with freshly steamed rice. The crispy chicken should be nicely coated with the spicy-sweet sauce, and every bite should have that perfect balance of flavors.