The database is hidden behind the wallet interface, which has all the wallet specific functionality. First up is the tracking of outputs.