Skip to content

Commit

Permalink
Update link to p2_delegated_by_singleton.clsp
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljperry committed Dec 12, 2024
1 parent fe50501 commit bb897ef
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions CHIPs/chip-0038.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ The puzzle structure looks like this:
├── TAIL ([everything_with_singleton](https://github.com/Chia-Network/chia-blockchain/blob/469b8024a26e81d62b6e8e5336312b223c2f3606/chia/wallet/revocable_cats/everything_with_singleton.clsp)) \
├── Revocation layer ([revocation_layer.clsp](https://github.com/Chia-Network/chia-blockchain/blob/469b8024a26e81d62b6e8e5336312b223c2f3606/chia/wallet/revocable_cats/revocation_layer.clsp)) \
├──── Inner puzzle (the `p2` puzzle that would usually go into `cat_v2`) \
├──── hidden_puzzle ([p2_delegated_by_singleton.clsp](https://github.com/Chia-Network/chia-blockchain/blob/469b8024a26e81d62b6e8e5336312b223c2f3606/chia/wallet/revocable_cats/p2_delegated_by_singleton.clsp))
├──── hidden_puzzle ([p2_delegated_by_singleton.clsp](https://github.com/greimela/chia-blockchain/blob/b29d87fcbecf817bb0eda9c4bd8e823facf5a359/chia/wallet/revocable_cats/p2_delegated_by_singleton.clsp))

A few notes about this structure:
* The outer layer is the same puzzle used by CATs that follow the CAT2 standard
Expand Down Expand Up @@ -117,25 +117,33 @@ The message mode used with the hidden puzzle is `puzzle to coin_id` (010111), wh
#### Structure

```
; This puzzle is used to delegate a spend to a singleton.
; The singleton will authorize the spend by sending a message via the SEND_MESSAGE condition.
(mod (
SINGLETON_STRUCT
SINGLETON_MOD_HASH
SINGLETON_STRUCT_HASH ; The hash of (SINGLETON_MOD_HASH . (LAUNCHER_ID . SINGLETON_LAUNCHER_HASH))
singleton_inner_puzzle_hash
delegated_puzzle
delegated_solution
)
(include condition_codes.clib)
(include curry-and-treehash.clib)
(include curry.clib)
(include sha256tree.clib)
(defun-inline calculate_full_puzzle_hash (SINGLETON_STRUCT inner_puzzle_hash)
(puzzle-hash-of-curried-function (f SINGLETON_STRUCT)
(defun-inline calculate_full_puzzle_hash (SINGLETON_MOD_HASH SINGLETON_STRUCT_HASH inner_puzzle_hash)
(curry_hashes_inline SINGLETON_MOD_HASH
SINGLETON_STRUCT_HASH
inner_puzzle_hash
(sha256tree SINGLETON_STRUCT)
)
)
(c
(list RECEIVE_MESSAGE 23 (sha256tree delegated_puzzle) (calculate_full_puzzle_hash SINGLETON_STRUCT singleton_inner_puzzle_hash))
(list RECEIVE_MESSAGE
23 ; = 010 111, mask for puzzle hash to coin ID
(sha256tree delegated_puzzle)
(calculate_full_puzzle_hash SINGLETON_MOD_HASH SINGLETON_STRUCT_HASH singleton_inner_puzzle_hash)
)
(a delegated_puzzle delegated_solution)
)
)
Expand All @@ -149,7 +157,7 @@ The message mode used with the hidden puzzle is `puzzle to coin_id` (010111), wh
## Reference Implementation

Revocable CATs are comprised of the following Chialisp puzzles:
* [p2_delegated_by_singleton.clsp](https://github.com/Chia-Network/chia-blockchain/blob/469b8024a26e81d62b6e8e5336312b223c2f3606/chia/wallet/revocable_cats/p2_delegated_by_singleton.clsp)
* [p2_delegated_by_singleton.clsp](https://github.com/greimela/chia-blockchain/blob/b29d87fcbecf817bb0eda9c4bd8e823facf5a359/chia/wallet/revocable_cats/p2_delegated_by_singleton.clsp)
* [everything_with_singleton.clsp](https://github.com/Chia-Network/chia-blockchain/blob/469b8024a26e81d62b6e8e5336312b223c2f3606/chia/wallet/revocable_cats/everything_with_singleton.clsp)
* [Revocation layer](https://github.com/Chia-Network/chia-blockchain/blob/469b8024a26e81d62b6e8e5336312b223c2f3606/chia/wallet/revocable_cats/revocation_layer.clsp)

Expand Down

0 comments on commit bb897ef

Please sign in to comment.