forked from julia-social/julia_did_chialisp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathissuer_key.clsp
More file actions
107 lines (100 loc) · 4.22 KB
/
Copy pathissuer_key.clsp
File metadata and controls
107 lines (100 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
;; Copyright 2026 Julia.Social, Inc.
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
(mod (CURRIED-ARGS-HASH
curried-args
; issuer-did-launcher-id
; issuer-key-puzzlehash
; julia-did-puzzlehash
; my-launcher-id
; public-key
; revocation-bitfield-root
; valid-from
; valid-to
; max-expiration
; cred-property-hash-root
; mode-1-payment-puzzlehash
; mode-1-payment-mojos
parent-info ; list
; parent-type ; bool zero = eve coin, one = regular coin
; issuer-did-parent
; issuer-did-curried-args-hash
; launcher-amount
spend-mode
spend-mode-args)
; This is the issuer key singleton. Its pre-launcher is a particular Julia DID. It defines a key
; that can be used to sign credential claims.
(include *standard-cl-26*)
(defun print (l x) (i (all "$print$" l x) x x))
(include "condition_codes.clib")
(include "curry_and_treehash.clib")
(include "sha256tree.clib")
(include "did_puzzles.clib")
(embed-file singleton-launcher-puzzlehash bin "singleton_launcher.clsp.hash.bin")
(embed-file issuer-key-functions-puzzlehash bin "issuer_key_functions.clsp.hash.bin")
(assign
issuer-did-launcher-id (f curried-args)
issuer-key-puzzlehash (f (r curried-args))
julia-did-puzzlehash (f (r (r curried-args)))
my-launcher-id (f (r (r (r curried-args))))
( parent-type
issuer-did-parent
issuer-did-curried-args-hash
launcher-amount
) parent-info
issuer-did-puzzlehash (julia-DID-coin-puzzlehash julia-did-puzzlehash issuer-did-launcher-id issuer-did-curried-args-hash)
issuer-did-coin-id (coinid issuer-did-parent issuer-did-puzzlehash 1)
launcher-coin-id (coinid issuer-did-coin-id singleton-launcher-puzzlehash launcher-amount)
my-coin-ph (issuer-key-coin-puzzlehash issuer-key-puzzlehash my-launcher-id CURRIED-ARGS-HASH)
my-puzzle-hash (issuer-key-curried-puzzlehash issuer-key-puzzlehash CURRIED-ARGS-HASH)
(if (= CURRIED-ARGS-HASH (sha256tree curried-args))
(if (f parent-info)
; regular spend
(if (= launcher-coin-id my-launcher-id) ; fast-forward compatible lineage proof
(c (list ASSERT_MY_PUZZLEHASH my-coin-ph)
(if (= spend-mode 1)
(assign
mode-1-payment-puzzlehash (f (r (r (r (r (r (r (r (r (r (r curried-args)))))))))))
mode-1-payment-mojos (f (r (r (r (r (r (r (r (r (r (r (r curried-args))))))))))))
conditions
(list
(list CREATE_COIN my-puzzle-hash 1 (list issuer-did-launcher-id))
(list REMARK curried-args)
(list CREATE_PUZZLE_ANNOUNCEMENT "JDIDA")
(list CREATE_COIN mode-1-payment-puzzlehash mode-1-payment-mojos)
)
(if (logand mode-1-payment-mojos 1)
(x 42) ; singleton can't have an odd child coin
conditions
)
)
(if (= issuer-key-functions-puzzlehash (sha256tree (f spend-mode-args)))
(a (f spend-mode-args) (list curried-args spend-mode (r spend-mode-args)))
(x 9) ; invalid puzzle
)
)
)
(x 10) ; invalid lineage proof
)
; eve spend
(list
(list ASSERT_MY_PARENT_ID launcher-coin-id)
(list CREATE_COIN (issuer-key-curried-puzzlehash issuer-key-puzzlehash CURRIED-ARGS-HASH) 1)
(list REMARK curried-args)
(list SEND_MESSAGE 0x3F "JDIDI" issuer-did-coin-id)
)
)
(x 11) ; invalid curried args
)
)
)