Prepare onions: Finely slice 2 yellow onions using a knife or mandolin set to 2-3 mm thickness.
Prepare potatoes: Peel, rinse, and cut 400g potatoes into thin matchstick fries using a mandolin or food processor with slicing discs (2-3 mm). Do not rinse fries after cutting to preserve starch for crustiness.
Prepare cod: If salted, soak cod in water for 24 hours, changing water several times to remove salt. If desalted, rinse and poach cod in hot water for about 5 minutes to cook.
Cook onions: Heat 5 cl olive oil in a large saucepan or casserole over medium heat. Add sliced onions and 2 bay leaves. Cook for 10-30 minutes, stirring regularly, until onions are caramelized to desired level.
Add garlic: Add 2-3 cloves of pressed garlic to the caramelized onions and cook for 2-3 minutes, stirring.
Add cod and seasonings: Add the poached cod to the onions. Season with 1/2 teaspoon smoked paprika, freshly ground black pepper, and a generous pinch of salt. Stir briefly for about 1 minute.
Add parsley and fries: Add a generous handful of chopped flat-leaf parsley. Fry the matchstick fries in vegetable or beef fat heated to 180°C until golden brown. Add the fries to the cod and onion mixture and mix thoroughly.
Bind with eggs: Whisk 6 eggs until yolks and whites are fully combined. Pour eggs into the pan with the cod, onion, and fries mixture. Cook over low heat, stirring gently, until desired firmness or viscosity is reached.
Serve: Turn off heat and serve the bakayao with black olives and reserved crispy fries on the side.