mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
3a7b3762a1
When we accept a bid to create a channel lease, we send back a signature committing to our max channel lease amounts.
8.5 KiB
8.5 KiB
1 | # Clients should not give a bad request but not the HSM's decision to crash. |
---|---|
2 | msgtype,hsmstatus_client_bad_request,1000 |
3 | msgdata,hsmstatus_client_bad_request,id,node_id, |
4 | msgdata,hsmstatus_client_bad_request,description,wirestring, |
5 | msgdata,hsmstatus_client_bad_request,len,u16, |
6 | msgdata,hsmstatus_client_bad_request,msg,u8,len |
7 | #include <bitcoin/chainparams.h> |
8 | # Start the HSM. |
9 | msgtype,hsmd_init,11 |
10 | msgdata,hsmd_init,bip32_key_version,bip32_key_version, |
11 | msgdata,hsmd_init,chainparams,chainparams, |
12 | msgdata,hsmd_init,hsm_encryption_key,?secret, |
13 | msgdata,hsmd_init,dev_force_privkey,?privkey, |
14 | msgdata,hsmd_init,dev_force_bip32_seed,?secret, |
15 | msgdata,hsmd_init,dev_force_channel_secrets,?secrets, |
16 | msgdata,hsmd_init,dev_force_channel_secrets_shaseed,?sha256, |
17 | #include <common/bip32.h> |
18 | msgtype,hsmd_init_reply,111 |
19 | msgdata,hsmd_init_reply,node_id,node_id, |
20 | msgdata,hsmd_init_reply,bip32,ext_key, |
21 | msgdata,hsmd_init_reply,bolt12,pubkey32, |
22 | # Get a new HSM FD, with the specified capabilities |
23 | msgtype,hsmd_client_hsmfd,9 |
24 | # Which identity to use for requests |
25 | msgdata,hsmd_client_hsmfd,id,node_id, |
26 | # Database id for this client, if any. |
27 | msgdata,hsmd_client_hsmfd,dbid,u64, |
28 | msgdata,hsmd_client_hsmfd,capabilities,u64, |
29 | # No content, just an fd. |
30 | msgtype,hsmd_client_hsmfd_reply,109 |
31 | #include <common/derive_basepoints.h> |
32 | # Get the basepoints and funding key for this specific channel. |
33 | msgtype,hsmd_get_channel_basepoints,10 |
34 | msgdata,hsmd_get_channel_basepoints,peerid,node_id, |
35 | msgdata,hsmd_get_channel_basepoints,dbid,u64, |
36 | msgtype,hsmd_get_channel_basepoints_reply,110 |
37 | msgdata,hsmd_get_channel_basepoints_reply,basepoints,basepoints, |
38 | msgdata,hsmd_get_channel_basepoints_reply,funding_pubkey,pubkey, |
39 | # Return signature for a funding tx. |
40 | #include <common/utxo.h> |
41 | # Master asks the HSM to sign a node_announcement |
42 | msgtype,hsmd_node_announcement_sig_req,6 |
43 | msgdata,hsmd_node_announcement_sig_req,annlen,u16, |
44 | msgdata,hsmd_node_announcement_sig_req,announcement,u8,annlen |
45 | msgtype,hsmd_node_announcement_sig_reply,106 |
46 | msgdata,hsmd_node_announcement_sig_reply,signature,secp256k1_ecdsa_signature, |
47 | # Sign a withdrawal request |
48 | #include <bitcoin/psbt.h> |
49 | msgtype,hsmd_sign_withdrawal,7 |
50 | msgdata,hsmd_sign_withdrawal,num_inputs,u16, |
51 | msgdata,hsmd_sign_withdrawal,inputs,utxo,num_inputs |
52 | msgdata,hsmd_sign_withdrawal,psbt,wally_psbt, |
53 | msgtype,hsmd_sign_withdrawal_reply,107 |
54 | msgdata,hsmd_sign_withdrawal_reply,psbt,wally_psbt, |
55 | # Sign an invoice |
56 | msgtype,hsmd_sign_invoice,8 |
57 | msgdata,hsmd_sign_invoice,len,u16, |
58 | msgdata,hsmd_sign_invoice,u5bytes,u8,len |
59 | msgdata,hsmd_sign_invoice,hrplen,u16, |
60 | msgdata,hsmd_sign_invoice,hrp,u8,hrplen |
61 | msgtype,hsmd_sign_invoice_reply,108 |
62 | msgdata,hsmd_sign_invoice_reply,sig,secp256k1_ecdsa_recoverable_signature, |
63 | # Give me ECDH(node-id-secret,point) |
64 | msgtype,hsmd_ecdh_req,1 |
65 | msgdata,hsmd_ecdh_req,point,pubkey, |
66 | msgtype,hsmd_ecdh_resp,100 |
67 | msgdata,hsmd_ecdh_resp,ss,secret, |
68 | msgtype,hsmd_cannouncement_sig_req,2 |
69 | msgdata,hsmd_cannouncement_sig_req,calen,u16, |
70 | msgdata,hsmd_cannouncement_sig_req,ca,u8,calen |
71 | msgtype,hsmd_cannouncement_sig_reply,102 |
72 | msgdata,hsmd_cannouncement_sig_reply,node_signature,secp256k1_ecdsa_signature, |
73 | msgdata,hsmd_cannouncement_sig_reply,bitcoin_signature,secp256k1_ecdsa_signature, |
74 | msgtype,hsmd_cupdate_sig_req,3 |
75 | msgdata,hsmd_cupdate_sig_req,culen,u16, |
76 | msgdata,hsmd_cupdate_sig_req,cu,u8,culen |
77 | msgtype,hsmd_cupdate_sig_reply,103 |
78 | msgdata,hsmd_cupdate_sig_reply,culen,u16, |
79 | msgdata,hsmd_cupdate_sig_reply,cu,u8,culen |
80 | # Master asks HSM to sign a commitment transaction. |
81 | msgtype,hsmd_sign_commitment_tx,5 |
82 | msgdata,hsmd_sign_commitment_tx,peer_id,node_id, |
83 | msgdata,hsmd_sign_commitment_tx,channel_dbid,u64, |
84 | msgdata,hsmd_sign_commitment_tx,tx,bitcoin_tx, |
85 | msgdata,hsmd_sign_commitment_tx,remote_funding_key,pubkey, |
86 | msgtype,hsmd_sign_commitment_tx_reply,105 |
87 | msgdata,hsmd_sign_commitment_tx_reply,sig,bitcoin_signature, |
88 | # Onchaind asks HSM to sign a spend to-us. Four variants, since each set |
89 | # of keys is derived differently... |
90 | # FIXME: Have master tell hsmd the keyindex, so it can validate output! |
91 | msgtype,hsmd_sign_delayed_payment_to_us,12 |
92 | msgdata,hsmd_sign_delayed_payment_to_us,commit_num,u64, |
93 | msgdata,hsmd_sign_delayed_payment_to_us,tx,bitcoin_tx, |
94 | msgdata,hsmd_sign_delayed_payment_to_us,wscript_len,u16, |
95 | msgdata,hsmd_sign_delayed_payment_to_us,wscript,u8,wscript_len |
96 | msgtype,hsmd_sign_remote_htlc_to_us,13 |
97 | msgdata,hsmd_sign_remote_htlc_to_us,remote_per_commitment_point,pubkey, |
98 | msgdata,hsmd_sign_remote_htlc_to_us,tx,bitcoin_tx, |
99 | msgdata,hsmd_sign_remote_htlc_to_us,wscript_len,u16, |
100 | msgdata,hsmd_sign_remote_htlc_to_us,wscript,u8,wscript_len |
101 | msgdata,hsmd_sign_remote_htlc_to_us,option_anchor_outputs,bool, |
102 | msgtype,hsmd_sign_penalty_to_us,14 |
103 | msgdata,hsmd_sign_penalty_to_us,revocation_secret,secret, |
104 | msgdata,hsmd_sign_penalty_to_us,tx,bitcoin_tx, |
105 | msgdata,hsmd_sign_penalty_to_us,wscript_len,u16, |
106 | msgdata,hsmd_sign_penalty_to_us,wscript,u8,wscript_len |
107 | # Onchaind asks HSM to sign a local HTLC success or HTLC timeout tx. |
108 | msgtype,hsmd_sign_local_htlc_tx,16 |
109 | msgdata,hsmd_sign_local_htlc_tx,commit_num,u64, |
110 | msgdata,hsmd_sign_local_htlc_tx,tx,bitcoin_tx, |
111 | msgdata,hsmd_sign_local_htlc_tx,wscript_len,u16, |
112 | msgdata,hsmd_sign_local_htlc_tx,wscript,u8,wscript_len |
113 | msgdata,hsmd_sign_local_htlc_tx,option_anchor_outputs,bool, |
114 | # Openingd/channeld asks HSM to sign the other sides' commitment tx. |
115 | msgtype,hsmd_sign_remote_commitment_tx,19 |
116 | msgdata,hsmd_sign_remote_commitment_tx,tx,bitcoin_tx, |
117 | msgdata,hsmd_sign_remote_commitment_tx,remote_funding_key,pubkey, |
118 | msgdata,hsmd_sign_remote_commitment_tx,remote_per_commit,pubkey, |
119 | msgdata,hsmd_sign_remote_commitment_tx,option_static_remotekey,bool, |
120 | # channeld asks HSM to sign remote HTLC tx. |
121 | msgtype,hsmd_sign_remote_htlc_tx,20 |
122 | msgdata,hsmd_sign_remote_htlc_tx,tx,bitcoin_tx, |
123 | msgdata,hsmd_sign_remote_htlc_tx,len,u16, |
124 | msgdata,hsmd_sign_remote_htlc_tx,wscript,u8,len |
125 | msgdata,hsmd_sign_remote_htlc_tx,remote_per_commit_point,pubkey, |
126 | msgdata,hsmd_sign_remote_htlc_tx,option_anchor_outputs,bool, |
127 | # closingd asks HSM to sign mutual close tx. |
128 | msgtype,hsmd_sign_mutual_close_tx,21 |
129 | msgdata,hsmd_sign_mutual_close_tx,tx,bitcoin_tx, |
130 | msgdata,hsmd_sign_mutual_close_tx,remote_funding_key,pubkey, |
131 | # Reply for all the above requests. |
132 | msgtype,hsmd_sign_tx_reply,112 |
133 | msgdata,hsmd_sign_tx_reply,sig,bitcoin_signature, |
134 | # Openingd/channeld/onchaind asks for Nth per_commitment_point, if > 2, gets N-2 secret. |
135 | msgtype,hsmd_get_per_commitment_point,18 |
136 | msgdata,hsmd_get_per_commitment_point,n,u64, |
137 | msgtype,hsmd_get_per_commitment_point_reply,118 |
138 | msgdata,hsmd_get_per_commitment_point_reply,per_commitment_point,pubkey, |
139 | msgdata,hsmd_get_per_commitment_point_reply,old_commitment_secret,?secret, |
140 | # master -> hsmd: do you have a memleak? |
141 | msgtype,hsmd_dev_memleak,33 |
142 | msgtype,hsmd_dev_memleak_reply,133 |
143 | msgdata,hsmd_dev_memleak_reply,leak,bool, |
144 | # channeld asks to check if claimed future commitment_secret is correct. |
145 | msgtype,hsmd_check_future_secret,22 |
146 | msgdata,hsmd_check_future_secret,n,u64, |
147 | msgdata,hsmd_check_future_secret,commitment_secret,secret, |
148 | msgtype,hsmd_check_future_secret_reply,122 |
149 | msgdata,hsmd_check_future_secret_reply,correct,bool, |
150 | # lightningd asks us to sign a string. |
151 | msgtype,hsmd_sign_message,23 |
152 | msgdata,hsmd_sign_message,len,u16, |
153 | msgdata,hsmd_sign_message,msg,u8,len |
154 | msgtype,hsmd_sign_message_reply,123 |
155 | msgdata,hsmd_sign_message_reply,sig,secp256k1_ecdsa_recoverable_signature, |
156 | # lightningd needs to get a scriptPubkey for a utxo with closeinfo |
157 | msgtype,hsmd_get_output_scriptpubkey,24 |
158 | msgdata,hsmd_get_output_scriptpubkey,channel_id,u64, |
159 | msgdata,hsmd_get_output_scriptpubkey,peer_id,node_id, |
160 | msgdata,hsmd_get_output_scriptpubkey,commitment_point,?pubkey, |
161 | msgtype,hsmd_get_output_scriptpubkey_reply,124 |
162 | msgdata,hsmd_get_output_scriptpubkey_reply,script_len,u16, |
163 | msgdata,hsmd_get_output_scriptpubkey_reply,script,u8,script_len |
164 | # Sign a bolt12-style merkle hash |
165 | msgtype,hsmd_sign_bolt12,25 |
166 | msgdata,hsmd_sign_bolt12,messagename,wirestring, |
167 | msgdata,hsmd_sign_bolt12,fieldname,wirestring, |
168 | msgdata,hsmd_sign_bolt12,merkleroot,sha256, |
169 | # This is for invreq payer_id (temporary keys) |
170 | msgdata,hsmd_sign_bolt12,publictweaklen,u16, |
171 | msgdata,hsmd_sign_bolt12,publictweak,u8,publictweaklen |
172 | msgtype,hsmd_sign_bolt12_reply,125 |
173 | msgdata,hsmd_sign_bolt12_reply,sig,bip340sig, |
174 | # Sign an option_will_fund offer hash |
175 | msgtype,hsmd_sign_option_will_fund_offer,26 |
176 | msgdata,hsmd_sign_option_will_fund_offer,funding_pubkey,pubkey, |
177 | msgdata,hsmd_sign_option_will_fund_offer,blockheight,u32, |
178 | msgdata,hsmd_sign_option_will_fund_offer,channel_fee_base_max_msat,u32, |
179 | msgdata,hsmd_sign_option_will_fund_offer,channel_fee_proportional_basis_max,u16, |
180 | msgtype,hsmd_sign_option_will_fund_offer_reply,126 |
181 | msgdata,hsmd_sign_option_will_fund_offer_reply,rsig,secp256k1_ecdsa_signature, |