@@ -221,6 +221,35 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_create_o
221
221
const unsigned char * label_tweak32
222
222
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
223
223
224
+ /** Create Silent Payment output private key (for spending receiver's funds).
225
+ *
226
+ * Given a shared_secret, a recipient's spend private key b_spend, an output
227
+ * counter k, and an optional label_tweak, calculate the corresponding
228
+ * output private key d:
229
+ *
230
+ * b_m = b_spend + label_tweak
231
+ * (if no label tweak is used, them b_m = b_spend)
232
+ * d = (b_m + hash(shared_secret || ser_32(k))) mod n
233
+ *
234
+ * Returns: 1 if private key creation was successful. 0 if an error occured.
235
+ * Args: ctx: pointer to a context object
236
+ * Out: output_seckey: pointer to the resulting spending private key
237
+ * In: shared_secret33: shared secret, derived from either sender's
238
+ * or receiver's perspective with routines from above
239
+ * receiver_spend_seckey: pointer to the receiver's spend private key
240
+ * k: output counter (usually set to 0, should be increased for
241
+ * every additional output to the same recipient)
242
+ * label_tweak32: an optional 32-byte label tweak (NULL if no label is used)
243
+ */
244
+ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_create_output_seckey (
245
+ const secp256k1_context * ctx ,
246
+ unsigned char * output_seckey ,
247
+ const unsigned char * shared_secret33 ,
248
+ const unsigned char * receiver_spend_seckey ,
249
+ unsigned int k ,
250
+ const unsigned char * label_tweak32
251
+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
252
+
224
253
#ifdef __cplusplus
225
254
}
226
255
#endif
0 commit comments