In a small dry skillet over medium heat, toast pepper, ginger, cinnamon, cloves, onion powder, and cayenne pepper until fragrant, 1 to 2 minutes. Transfer to small bowl.
Meanwhile, in a medium bowl whisk vinegar, molasses, water, fish sauce and tamarind paste (if using) together.
In a small saucepan over medium heat, heat oil until shimmering. Add shallots and cook until softened, about 5 minutes. Stir in spices, anchovy paste, and garlic until fragrant, about 30 seconds.
Whisk in vinegar mixture, scraping up any fond on the bottom of the pan. Bring to boil, remove from heat, and cool 1 hour.
Strain through fine-mesh sieve or cheesecloth into medium bowl, pressing down on the solids to extract as much liquid as possible. Discard solids.
Transfer to jar with tight-fitting lid. Enjoy immediately or refrigerate for up to 6 months.