Question: Atomic Multisig Funding

I have been looking for a way to set up a 2of2 multisig UTXO with the caveat that the funding TX is invalid until both parties have actually commited what ever amount they agreed to. My understanding of the topic is somewhat basic so the following sketch is the best scheme I could come up with:

https://preview.redd.it/o4rdyikqqqx31.png?width=2369&format=png&auto=webp&s=71ef2e9014f3974e2eca196252ecce959bbc2fc3

I was wondering whether there is a better way to achieve the same functionality. Reading about Bitcoin and “programmable money” I expected to be able to implement such a scheme entirely within the locking script. Thus being able to use a standard Bitcoin Wallet to fund the UTXO instead of having to write my own wallet or implementing my own peer2peer communitaction network… Going through the list of Opcodes however I find no ability to reference anything outside the script itself. I can push data to stacks, add, multiply, reverse and flip bits, etc. But afaict I have to define all data inside the script itself.

When an unlocking script is executed, is it entirely unaware of its context? Such as at which block height its inputs were mined at, or whether the UTXOs it generates are duplicates?

submitted by /u/xep426
[link] [comments]