Imagine adding a scripting language to Grin.
Not to the consensus model, where it causes undesirable complexity and attack surface, but to the wallet.
Imagine script support for all the primitives MW can make use of: things like key derivation, nonce generation, signing, key/nonce/signature aggregation, bulletproof generation (single and multi-user), absolute and relative height locks, adaptive signatures, input selection, fee negotiation/splitting, payment proofs, storage of partially signed transactions for possible future use, and more (building self-spend mixing onions?!).
Such a programmable wallet would have to make use of programmable slates as well.
Scripts would roughly correspond to protocols, enumerating the various states that the protocol can be in, and how to transition between them.
The language would have to make it easy to reason about script behaviour, and make it hard to form nonsensical scripts. Being strongly typed and declarative could help in this regard.
With such a scripting system in place, adopting new functionality, like payment channels, could be a simple matter of installing a new script of a few dozen lines of code. Something that’s much easier to audit than a big PR of the wallet codebase.
Design of such a scripting system would be a huge undertaking, and take years to crystallize. The good thing is that we need not design for perfection. If a better design becomes available, then we can migrate away, and in due time would no longer have to keep any support in place for the old one. This is even easier if accessibility of the system is limited to testnet until it has proven fit for purpose and reliable for a few years.
Do you think this is a worthwhile pursuit?
Do you see any downsides, beyond the huge design challenge and development effort required to implement this?