Open the chiles, breaking off their stems and shaking out and discarding most of their seeds. Break the pods into pieces. (Large chiles will be somewhat pliable, while small ones will be brittle.) Combine the chile pieces in a medium bowl and add warm water to cover them. Set aside to soak for about 30 minutes.
Meanwhile, put the coriander seeds in a small, dry skillet over medium-high heat. Cook, shaking the pan, until they darken to a golden brown color and become fragrant, 2 to 3 minutes. Transfer to a small plate.
Let the skillet cool for a few minutes and then toast the cumin seeds in the same way until nicely browned and fragrant, 1 to 2 minutes. Transfer to the plate with the coriander seeds.
Put the coriander, cumin, and peppercorns in a small spice grinder and finely grind. Transfer to a plate and set aside.
Chop off and discard the grassy tops of the lemongrass, leaving about 4 inches, including the rounded base and root end. Discard any dry or discolored outer leaves and trim off the root end to leave a smooth base just under the plump bulb. Slice crosswise into thin rounds and then chop coarsely; transfer to a medium bowl.
Drain the chiles well and add them to the bowl of chopped lemongrass along with the shallots, garlic, galangal, cilantro root, dried lime peel or lime zest, salt, and shrimp paste (if using). Add the ground spices and stir gently to combine.
Transfer to a food processor, add 1 or 2 Tbs. cold water, and process to an almost-smooth paste. If the paste hasn’t come together, add more water, 1 Tbs. at a time. Scrape the paste into a jar and cover tightly.