Since they are both replacement effects, which one is the one that works?
The person controlling the effect to be replaced chooses one of them to be applied. Thus, on your draw step, if you choose to use the Library, you can replace the extra draws with either the Chains effect or the Mask effect. In other words, Mask completely negates the effects of Chains.
This is similar to this: say you've cast Will and you cast TfK and discard DSK. Then you have two replacement effects competing: the RFG the card since it would be put into the graveyard from Will, and the shuffle-in effect of DSK. You pick which one you want to happen and the other is ignored. I once saw this happen during a Mindslaver turn once, and the "Shuffle-in" effect was chosen after Tinker was removed from the game.
if you have an uba in play, do you not lose to decking since you are not actually drawing a card, but removing it from the game face up instead ?
You never actually draw a card with Uba Mask out there, and you only lose the game if you try to draw a card and cannot. Since the draws are replaced, neither player can lose to an empty library with Uba Mask in play.