-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add bls_with_taproot puzzle and member class
- Loading branch information
1 parent
4652380
commit f3d542f
Showing
5 changed files
with
194 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
chia/wallet/puzzles/custody/member_puzzles/bls_with_taproot_member.clsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
; this puzzle follows the Managed Inner Puzzle Spec MIPS01 as a Member Puzzle | ||
; this code offers a secure approval of a delegated puzzle passed in as a Truth to be run elsewhere | ||
|
||
; Delegated_Puzzle_Hash is added to the solution in the above layer | ||
; original_public_key, hidden_puzzle and solution are only for use in the taproot case | ||
; set original_public_key to 0 for non-taproot case | ||
(mod (SYNTHETIC_PUBLIC_KEY Delegated_Puzzle_Hash original_public_key hidden_puzzle solution) | ||
(include condition_codes.clib) | ||
|
||
(defmacro assert items | ||
(if (r items) | ||
(list if (f items) (c assert (r items)) (q . (x))) | ||
(f items) | ||
) | ||
) | ||
|
||
(defun sha256tree1 | ||
(TREE) | ||
(if (l TREE) | ||
(sha256 2 (sha256tree1 (f TREE)) (sha256tree1 (r TREE))) | ||
(sha256 1 TREE) | ||
) | ||
) | ||
|
||
; "is_hidden_puzzle_correct" returns true iff the hidden puzzle is correctly encoded | ||
|
||
(defun-inline is_hidden_puzzle_correct (SYNTHETIC_PUBLIC_KEY original_public_key hidden_puzzle) | ||
(= | ||
SYNTHETIC_PUBLIC_KEY | ||
(point_add | ||
original_public_key | ||
(pubkey_for_exp (sha256 original_public_key (sha256tree1 hidden_puzzle))) | ||
) | ||
) | ||
) | ||
|
||
; "possibly_prepend_aggsig" is the main entry point | ||
|
||
(if original_public_key | ||
(assert | ||
(is_hidden_puzzle_correct SYNTHETIC_PUBLIC_KEY original_public_key hidden_puzzle) | ||
(a hidden_puzzle (c Delegated_Puzzle_Hash solution)) | ||
) | ||
(list (list AGG_SIG_ME SYNTHETIC_PUBLIC_KEY Delegated_Puzzle_Hash)) | ||
) | ||
) | ||
|
1 change: 1 addition & 0 deletions
1
chia/wallet/puzzles/custody/member_puzzles/bls_with_taproot_member.clsp.hex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ff02ffff01ff02ffff03ff17ffff01ff02ffff03ffff09ff05ffff1dff17ffff1effff0bff17ffff02ff06ffff04ff02ffff04ff2fff8080808080808080ffff01ff02ff2fffff04ff0bff5f8080ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ff0bff80808080ff808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters