This isn't a technology problem. Congress could put whatever restrictions on UBI it wants to. The technology would be required to implement whatever kind of UBI system Congress made into law. Congress could also change the law any time in the future -- and every time party control over congress changes, you can bet they will push for tweaks to UBI that they promised to their base.
The most likely outcome, which happens with many other kinds of government programs, would be for Congress to delegate significant authority over UBI to some regulatory bureaucracy in the executive branch.
Similar to the way the IRS, EPA, and FDA work, there would be some department of UBI with broad discretion over how the law is interpreted, the ability create additional regulations and fine people who do not obey them, etc.
You can't solve this problem with code. It's a political problem.