Recreating a singleton with the same puzzle

Hi guys.

Hope someone is able to help me. I’ve succeeded in creating a singleton eve coin with a custom inner puzzle inside. I’m trying to make a singleton which then recreates itself with the same puzzlehash.

This is the current (super simple) inner puzzle:


    (include condition_codes.clib)

            (list ASSERT_MY_PUZZLEHASH puzzhash_tocreate)
            (list Create_coin puzzhash_tocreate 1)

The problem I’m having is that the spend of the eve coin passes, (as the conditions pass), but the new coin which is created does not have the same puzzlehash that I pass in to the create coin condition. I presume this is because the singleton top layer wraps this? I thought that it checked the create coin conditions to see if it was a singleton being created though? Has anyone got any thought on the correct way around this?



Have you tried CREATE_COIN instead of “Create_coin”? My condition_codes.clib file requires it all caps, otherwise it errors.

Thanks for your reply.

I actually found the solution for any others browsing (although yes this should have been caps) - The create coin condition passed in needs to be the singleton inner puzzle not the entire coin puzzle. The singleton puzzle then automatically wraps this so you end up with the correct Puzzlehash.

OK cool. Care to post the CLSP and a valid solution so I can reference?

The singleton puzzle hash is based on SINGLETON_STRUCT which is based on the launcher_id and inner_puzzle, so if inner_puzzle, hence, its inner_puzzle_hash is not changed, the singleton puzzle hash should be the same.

Sorry I didn’t get back! - my code is quite long, but I’ll try condense a relevant section next week to demonstrate.

1 Like