Just a quick update on this. I took some time off from this after making the first version of the prototype, but am now again slowly improving it and have also started adding tests for it. The new version is located here Comparing mimblewimble:master...phyro:simple_contracts_restructured_v2 · mimblewimble/grin-wallet · GitHub.
I’ve tried to clean up the code a bit, at least the main parts. Perhaps the most interesting thing is that we have a rather simple way of expressing new, setup and sign functions that should work for both flows. If anyone has any suggestions about the structure or would like to contribute to this, let me know and I’ll gladly take this into account.
So far we have:
- Always add outputs to the slate at the sign step, never before (even with early lock). This gives us natural compaction of the slate inputs/outputs and doesn’t reveal these until absolutely necessary
- We can decide to add outputs early with
--add-outputs
flag. This locks the inputs and prepares the outputs, but only adds them to the local transaction context. As mentioned above, these get added to the slate at the sign step - We can pick inputs to use with
--use-inputs
- We can control additional outputs (change output is always present) with
--make-outputs=0.2,0.3,1.3
which means we create 4 outputs in total
This is still not safe to use with your a wallet that is on the mainnet and it won’t be until we get enough reviews. Later on when the GUI gets to the stage that it’s communicating with the wallet backend to create a transaction, I might try to modify it to use the contract code to have an example of contract usage over GUI.