To make the spice paste, put one-third of 1 onion in a large frying pan or wok over a medium heat with the coconut, chillies, tamarind, coriander seeds, asafoetida and cumin seeds. Toast for 5 minutes, stirring constantly. Remove from the heat and set aside to cool.
Transfer the toasted spice mixture to a grinder, and grind for 2–3 minutes. Then, in a large heavy saucepan, combine the ground spices with the remaining two-thirds of 1 onion and 400ml/14fl oz water. Bring the mixture to the boil, reduce the heat and simmer for 5 minutes, stirring occasionally.
Add the salt, then carefully break the eggs into the saucepan. Cover and cook for 5 minutes.
In a frying pan, heat the oil, then add the remaining onion and cook over a high heat, stirring, until brown. Remove from the heat and pour the contents of the frying pan over the eggs. Serve hot.