In a large bowl sift together the flour and baking powder then set aside.
In another large bowl cream together butter and sugar. Gradually add the vanilla and eggs while mixing. Stir in the flour mixture and mix until dough forms.
For plain biscotti do not add anything else. For star anise biscotti add the ground star anise. Add walnuts if desired.
Roll dough out into 4 logs approximately 20cm long, 2cm in height and 7cm wide. Place logs on baking trays 5cm apart. Brush with egg yolks and bake for 15 minutes until golden brown.
Slice on a diagonal slant; slices should be about 1cm wide. Lay slices back onto baking trays and return to the oven for 10 more minutes. Remove when the biscuits are dry and lightly toasted. Cool completely on cake racks.