Ljzn / mini_forth

https://mini-forth.vercel.app
BSD 2-Clause "Simplified" License
17 stars 5 forks source link

new word: Lock & Unlock #6

Open Ljzn opened 3 years ago

Ljzn commented 3 years ago

This is a proposal for 2 new words:

Unlock

spec: ( txid output_index unlock_script -- bool )

Lock

spec: ( txid { lock_script } -- txid1 )

Ljzn commented 3 years ago

One fantastic of forth is you can produce massive side effects, think about a washing machine.

We don't even have the list now!

Ljzn commented 3 years ago

Think about a template of the script: just like the HTML template, most things are static, and little things are dynamic. For P2PKH template, the pubkeyhash is dynamic.

If we have a monitor to sync all transactions that have the template we want, then we can run a MiniForth module repeatedly -- because the code can handle the lock script (for P2PKH, again, we know the privatekeys). And according to the result of unlock operation (in fact, it can return values other than bool), create new lockscripts.

The whole process is more like a human reacting to the changes in the world, than an automatic machine agent.