In a large bowl, add the chicken legs, and sprinkle them with the salt. Rub the salt in evenly, and let sit for at least 10 minutes. Heat a medium pot over medium-high heat, and add the oil. Sear the chicken legs until lightly browned on all sides. Remove the chicken to a plate.
Add the ginger, garlic, shallot/onion, and dried red chili peppers (if using). Cook until caramelized and fragrant.
Next, add the chicken stock and stir to deglaze the bottom of the pot. Add galangal powder, coriander powder, cloves, lime leaves, kecap manis, soy sauce, tamarind paste (if using) and the pepper. Stir to combine.
Bring the mixture to a simmer, and add the seared chicken and any juices back to the pot. Cook uncovered for 25 minutes, turning the chicken every 5 to 10 minutes for even cooking. Skim off any foam that may emerge at the surface.
Turn the heat up slightly and continue to cook off the liquid until the sauce thickens enough to coat a spoon. Taste for seasoning and add additional salt only if needed. Serve with rice and a stir-fried vegetable on the side.