Place chillies, sugar, salt, shrimp paste, tomato, onion, garlic, and lime juice into a blender, and blend until smooth.
Heat vegetable oil in a saucepan over medium-high heat. Stir in the chilli puree along with the lemongrass, curry leaves, and galangal. Cook and stir until the mixture changes color and becomes very fragrant, about 15 minutes. Stir in the tamarind juice, and cook for 1 minute more. Strain before serving.