_predicate/txSpec is set of smart functions that are attached to a particular predicate. Any time that predicate appears in a transaction, regardless of who issues the transaction, the smart functions attached to the
_predicate/txSpec will execute.
If all of the smart functions return true, the transaction will succeed. If any of the smart functions return false, it will fail.
The difference between
_predicate/txSpec is that smart functions attached to
_predicate/txSpec run only once, regardless of how many times that predicate appears in a transaction. For example, you would want to attach a smart function that checks whether a
wallet/balance is negative to a
_predicate/spec, because that needs to run once for every
wallet/balance in the transaction. However, a smart function that, for example, checks that the total amount of balance transacted is under 5,000, should be attached to
_predicate/txSpec, because that only needs to run once per transaction. This will become clearer when we get into more details about writing smart functions.
Predicate txSpec are mainly used to ensure that the balance spent is equal to the balance received. You can see an example of this in the cryptocurrency example.