Dry-toast the chiles de arbol and guajillo chiles in a medium cast-iron or nonstick skillet over medium heat until lightly blackened in spots, 30 seconds to 1 minute per side. Transfer to a medium bowl and cover with hot water; let sit for 20 minutes to soften. Drain.
Meanwhile, add the shrimp paste foil packet and the coriander, cumin, cardamom, cloves and cinnamon to the skillet. Toast the shrimp paste (in the foil), about 1 minute per side and stir to toast the spices until golden brown in spots and very fragrant, about 2 minutes total. Remove the foil packet and transfer the spices to a bowl. When completely cool, remove the shrimp paste from the foil and discard the foil. Grind the spices into a powder in a spice grinder.
Turn the heat up to medium-high. Add the lemongrass, galangal, garlic, cilantro roots and shallot and toast until blackened in spots, about 3 minutes. Transfer to a food processor and pulse until finely chopped. Add the drained chiles, toasted shrimp paste, ground spices, nutmeg and 3/4 teaspoon salt. Pulse and scrape down the food processor multiple times until you have a fine paste.
Place the curry paste and 1/2 cup coconut milk in a large pot or Dutch oven over medium heat. As the mixture cooks down, stir more frequently, scraping the bottom, until the oil separates and the paste sticks aggressively to the pan, 6 to 8 minutes. Add 3 tablespoons tamarind, the tablespoon fish sauce and tablespoon palm sugar and cook, stirring, a few seconds. Add the chicken thighs and turn in the curry paste to coat. Add the rest of the coconut milk, the peanuts, bay leaves, star anise, 1 teaspoon salt and 1 cup water.
Simmer gently, partially covered, until the chicken is almost cooked through and the liquid has reduced slightly, 40 minutes. Tuck in the potatoes and onion, making sure the potatoes are submerged in the liquid. Simmer, partially covered, until the potatoes are fork tender, about 20 more minutes. Add 2 more tablespoons of tamarind. Taste and adjust with more tamarind, fish sauce, sugar and salt, if necessary. There might be a layer of bright orange oil on top. Feel free to skim some of it off, but it is traditional to leave some oil in the curry.
Serve with the steamed jasmine rice.
Copyright 2016 Television Food Network, G.P. All rights reserved.