Heat 1 tbsp oil in a pan and saute chopped onions, ginger, garlic and green chillies for 2 minutes. Add chopped tomatoes, coconut and let it cook till tomatoes are soften.
Let it cool and blend it to smooth puree.
Add remaining oil to same pan. Once its hot, add asafoetida, prepared masala paste, 1/2 cup water and all the dry spices.
Let it cook in low flame till oil separates.
This masala paste can be made and refrigerated in advance.