How Does a Native Program Validate Proposed Transaction Changes?
A holds 100 units of an asset and has authorized S to spend up to 30 of them. S wants to use that permission to send 20 to B. After the transaction, A should have 80, B should have 20, and S's remaining allowance should be 10.
In nigo-protocol's Native Program path, the party constructing the transaction prepares these proposed changes first. The program checks whether the proposal satisfies the spending conditions. Preparing Direct Cell transactions examined how explicit inputs and outputs can be assembled and signed outside the ledger. Here, we add a spending approval condition to that way of constructing proposals and look inside Native Program validation.
Is it enough for the program to reply, “Allowed”? If the answer does not identify which of A's asset inputs may be used, or which approval record may be changed into what, the ledger cannot establish which inputs and state changes that authorization covers. This post asks how to connect a decision that spending conditions are satisfied to the records that actually change.