User Data and Solutions
We have described how Contracts, Predicates, and Constraints are how the validity of a state mutation is determined on-chain. In order for state to actually be changed, we first need a state mutation whose validity we can check.
User Data is the means by which users actually interact with the chain's state. To use a common (but severely overloaded) term, this is where the user expresses their intent.
The term "user data" refers to a subset of a solution that is "fixed" or fully constrained by the user. For example, if a user has a certain amount of Token A, and they want to swap this for Token B, they can constrain the addresses of Token A and B, and the amount of Token A they wish to swap. They would, however, not fully constrain the amount of Token B they wish to receive. They want to solver to find the solution that maximizes this amount. As we saw in the chapter on contracts, this logic can be contained by a contract which encodes the basic rules for a swap, which would be deployed once, and then be available to be used for any and all subsequent token swaps - for all users!
User data is signed over by the user. Hence, user data is strongly linked to authentication. For example a user might sign over a from, to, amount
for a transfer of tokens. If any of these values are changed then the signature will no longer be valid. This effectively constrains the data to a specific value.
Through a combination of deployed contracts, and User Data (partially constrained solutions), the user can build a sophisticated representation of the state changes they want to see occur.
Indeed, if the user is able, they can decide to fully constrain the solution through their user data, such that only a single solution is valid. In practice, users will want to leave at least part of the solution unconstrained (if only to allow for payment to the solver for inclusion). These partially constrained solutions are the starting point for solvers. Solvers look for values of the remaining, unconstrained decision variables, in order to create a solution which is valid.
Last updated