When coconut becomes dry, add some coconut oil and continue frying.
Add half of the shallots into it and keep on frying.
Then add coriander seeds, red chillies, pepper corns, fennel seeds, cinnamon, cardamom, cloves, poppy seeds and cashew nuts and fry all these ingredients in low fire until everything is fried well as in the pic.
When these fried ingredients is down to room temperature, grind them to a fine paste adding enough water.
Place a kadai on fire and add some coconut oil.
Add finely sliced onions and saute them.
When the onions are about to turn golden color, add crushed ingredients and keep on stirring until their rawness is gone.