Roast onions in a skillet until they turn a golden brown. Keep aside.
Heat oil in the skillet and fry the chillies until golden brown. Remove and keep aside. Reserve the oil.
Grind together all the ingredients for the paste. Reheat the oil in the skillet. Add the ground ingredients and let it cook, stirring often, for about 15 minutes. Add 1/4 cup water and cook for an additional 3-5 minutes.
Add the yogurt, tamarind and salt. Mix well and cook for 3-4 minutes.
Add the fried chillies, cook until the gravy starts to thicken and is the consistency of a sauce.
Remove from heat and garnish with cilantro and lemon juice.