In food processor, chop nuts and then add shallots, garlic, shrimp paste, ginger, salt and chiles. Make into a paste. Heat oil in skillet and stir-fry the paste over moderate heat for 2 minutes. Add coconut milk and sugar. Cook for 5 minutes. Add chicken and cook, covered , for 20 minutes. Put chicken and sauce into a baking dish and bake , uncovered, in 375 degree oven for 15 minutes or until brown on top. Serve over rice.