Peel and finely chop the onions and garlic. Peel the shallots, but leave whole.
Cut the lemon grass into 1in sections, from the bottom to about 1in from the top; cut off and discard the straw like top. Crush each section lightly with a mallet or other heavy object.
Heat 3 tablespoons of the oil in a non-stick frying pan over a medium-high heat.
Add the onions, garlic and shallots, and stir-fry for 2 minutes. Add the lemon grass and continue to fry, stirring, until the onions are lightly browned. Turn off the heat.
Take the shallots out of the pan and set aside.
Heat the remaining 4 tablespoons oil in a large, wide, preferably non-stick pan over a high heat. When hot, quickly fry the meat cubes in batches, turning to brown them all over. Remove with a slotted spoon. Brown all the meat in this way.
Return all the meat to the large pan. Add 4 cups water and the garlic mixture. Coarsely chop the beans in the yellow bean sauce (if not already crushed) and add them too.
Also put in the chili powder, star anise, cinnamon, peppercorns and sugar. Bring to the boil, then cover, lower the heat and simmer gently for 11/4 hours.
Add the reserved shallots, cover again, and simmer for a further 15 minutes.
Remove the lid, increase the heat to medium and cook for a further 15 minutes or until the sauce has thickened a little and the meat is tender. Skim the fat off the top of the stew before serving.