Transaction model and tests