Peel onions and slice thinly. Fry in oil until slightly golden. Wash chicken pieces and fry in onions until color changes. Add 3 glasses of hot water and bring to boil. Turn heat down and let boil slowly for about 30 minutes adding more hot water if needed.
Wash and rinse the herbs, then finely chop them. Peel garlic cloves and thinly slice them. Fry herbs and garlic in oil for a few minutes.
Add herbs, salt, ground walnuts and pomegranate juice or paste (if using pomegranate paste, add 2 more glasses of hot water and bring to slow boil). If pomegranate juice or paste is sour, add some sugar to the khoresht. Dissolve rice-flour in a cup of cold water and add to khoresht near the end of cooking.
Care should be taken to cook the khoresht long enough so that the oil in walnuts comes out and the mix becomes quite thick. Khoresht anaar-aveej should be served with white rice.