Each signature is a relation between two public keys on secp256k1, where 256-bit addition and multiplication can usually demonstrate, that a given entity can control a given private key, if it is done correctly, and if each step is verified according to the specification. However, ECDSA can also be used as a 256-bit calculator. The simplest example of such use case is when signature is placed in the output script, and user have to provide a matching public key, by using public key recovery:
<signature> OP_SWAP OP_CHECKSIG
If a given signature is signed with SIGHASH_ALL, then it is roughly equivalent to pushing message hash called z-value, converted to some public key, and modified by chosen r-value and s-value from that signature. However, public key recovery can be used more than once, and it is possible to form a chain of such operations. For example:
OP_DUP <signature> OP_SWAP OP_CHECKSIGVERIFY OP_CHECKSIG
Now, the solution is to put not only some public key, but also yet another signature, which would be valid for recovered public key (which would indirectly prove, that r-value of the signature can be controlled, and k-value is known, if it would be also signed with SIGHASH_ALL).
And that kind of chain can be continued further. We can start from "pubkeyA", allow using any "signatureB", apply public key recovery, and reach "pubkeyC", then again require "signatureD", and use public key recovery, to reach "pubkeyE". The total size of this chain is restricted by consensus rules, like maximum size of the Script, maximum number of sigops, and other similar limits.
However, by starting with some "pubkeyA", and ending the chain with some "pubkeyZ", if the final public key would have a private key, which would be equal to the hash of some arbitrary message, it would emulate OP_CHECKSIGFROMSTACK, without introducing any soft-fork, or other changes in consensus rules. It would allow wiring OP_CHECKSIGFROMSTACK as a virtual opcode, which could be replaced by a chain of opcodes, and by doing some operations on 256-bit numbers, it could be possible to translate some signed message to the proper Script.
Another interesting observation, is that OP_CHECKMULTISIG can enforce using identical z-value for all public keys in the chain. For example, here is how regular 3-of-3 multisig is made:
Input: <sigA> <sigB> <sigC>
Output: 3 <pubkeyA> <pubkeyB> <pubkeyC> 3 OP_CHECKMULTISIG
But it can also use public key recovery, and it is possible to put all signatures inside the output script:
Input: <pubkeyC> <pubkeyB> <pubkeyA>
Output: OP_TOALTSTACK OP_TOALTSTACK OP_TOALTSTACK <sigA> <sigB> <sigC> 3 OP_FROMALTSTACK OP_FROMALTSTACK OP_FROMALTSTACK 3 OP_CHECKMULTISIG
And then, different signatures can be executed on the same z-value, so results can be checked, if reached public keys are equal to some specific values, or not.
Another interesting hint is that SIGHASH_SINGLE can force z-value to have a constant value of "one", written in little endian, and that fact can be connected with OP_CHECKMULTISIG or OP_CHECKSIG operations on top of some Script, executed in out-of-bounds index.
Do you know, how to wire OP_CHECKSIGFROMSTACK, and write it as a combination of existing opcodes, like OP_CHECKSIG or OP_CHECKMULTISIG? Because the more I read about ECDSA, the more I am convinced, that it should be possible, and it is just a matter of writing some proper math equations, which would translate a valid signed message into a bunch of opcodes, which would execute it properly, regardless of the "txid:vout", where that Script would be placed.
I know it is possible to make things tick by doing it right, and making a soft-fork, but as more time passes, it is harder and harder to reach consensus, so it can be safely assumed, that in case of any disagreement, status quo will be preserved, so I am thinking about workarounds, if Bitcoin won't be changed in the future, and if "ossification" will be perceived as "no changes policy".