Heat a skillet on low heat and lightly toast the coconut for a minute before adding the rest of the spices (cloves, chillies, pepper and coriander) and toasting for 1 more minute, taking care not to burn them.
Cool the spices and grind to in a food processor. Add the turmeric and ginger and garlic and grind further to make a thick paste with a little water.
Heat oil in the same skillet. Throw in the curry leaves and the onions.
When the onions are lightly golden, add the spice paste and saute on low heat for a couple of minute till the smell of raw garlic and ginger changes.
Add the tamarind pulp, green chillies, salt and 200 ml water and bring the sauce to a gentle simmer.
Cover and gently cook for 2-3 minutes before putting in the crabs.
Coat the crabs well with the sauce, check the seasoning and simmer for 7-10 minutes till the crabs are cooked and turn a bright vermillion and the sauce is slightly thickened.