Cancel mojo technique

From mojo_puzzler
Jump to navigation Jump to search
Return to: Chialisp

The following chialisp code ensure that the introduced parent puzzlehash of the parent coin is correct first, before sending the rebate coin which is restricted to that one possible wallet address:

 (mod (pwd ppid pph pamt ph amt)
    (defconstant CREATE_COIN 51)
    (defconstant ASSERT_MY_PARENT_ID 71)
    (if (= pwd (q . cancel))
    (list (list ASSERT_MY_PARENT_ID (sha256 (concat ppid pph pamt))) 
    (list CREATE_COIN pph amt))
    (if (= pwd (q . hello))
    (list (list CREATE_COIN ph amt))
    (x)
    )
    )
 )