@@ -117,6 +117,10 @@ int main(void) {
117
117
secp256k1_xonly_pubkey * out_pubkeys_ptrs [N_TX_OUTPUTS ];
118
118
unsigned char output36 [36 ];
119
119
secp256k1_xonly_pubkey taproot_outputs [N_TX_INPUTS ];
120
+ secp256k1_pubkey plain_outputs [N_TX_INPUTS ];
121
+
122
+ unsigned char plain_seckeys [N_TX_INPUTS ][32 ];
123
+ const unsigned char * plain_seckeys_ptrs [N_TX_INPUTS ];
120
124
121
125
unsigned char randomize [32 ];
122
126
unsigned char xonly_print [32 ];
@@ -185,6 +189,10 @@ int main(void) {
185
189
printf ("Failed to create keypair\n" );
186
190
return 1 ;
187
191
}
192
+ if (!fill_random (plain_seckeys [i ], sizeof (plain_seckeys [i ]))) {
193
+ printf ("Failed to generate randomness\n" );
194
+ return 1 ;
195
+ }
188
196
}
189
197
/*** Create the recipient objects ***/
190
198
@@ -225,6 +233,25 @@ int main(void) {
225
233
generated_output_ptrs [i ] = & generated_outputs [i ];
226
234
}
227
235
236
+ for (i = 0 ; i < N_TX_INPUTS ; i ++ ) {
237
+ secp256k1_pubkey pubkey ;
238
+ unsigned char serialized_pubkey [33 ];
239
+ size_t len = 33 ;
240
+
241
+ ret = secp256k1_ec_pubkey_create (ctx , & pubkey , plain_seckeys [i ]);
242
+ assert (ret );
243
+ ret = secp256k1_ec_pubkey_serialize (ctx , serialized_pubkey , & len , & pubkey , SECP256K1_EC_COMPRESSED );
244
+ assert (ret );
245
+
246
+ printf ("plain_pubkeys %li:\n" , i );
247
+ print_hex (serialized_pubkey , 33 );
248
+
249
+
250
+ plain_seckeys_ptrs [i ] = plain_seckeys [i ];
251
+ }
252
+
253
+ printf ("\n" );
254
+
228
255
for (i = 0 ; i < N_TX_OUTPUTS ; i ++ ) {
229
256
out_pubkeys_ptrs [i ] = & out_pubkeys [i ];
230
257
}
@@ -236,8 +263,10 @@ int main(void) {
236
263
N_TX_OUTPUTS ,
237
264
smallest_outpoint ,
238
265
sender_seckey_ptrs , N_TX_INPUTS ,
266
+ plain_seckeys_ptrs , N_TX_INPUTS ,
239
267
output36 ,
240
- taproot_outputs
268
+ taproot_outputs ,
269
+ plain_outputs
241
270
);
242
271
assert (ret );
243
272
@@ -265,6 +294,9 @@ int main(void) {
265
294
unsigned char serialized_original_xonly_pubkey [32 ];
266
295
unsigned char serialized_xonly_pubkey [32 ];
267
296
297
+ unsigned char serialized_pubkey [33 ];
298
+ size_t len = 33 ;
299
+
268
300
ret = secp256k1_keypair_xonly_pub (ctx , & orignal_pubkey , NULL , & sender_seckeys [i ]);
269
301
assert (ret );
270
302
ret = secp256k1_xonly_pubkey_serialize (ctx , serialized_original_xonly_pubkey , & orignal_pubkey );
@@ -278,6 +310,13 @@ int main(void) {
278
310
print_hex (serialized_original_xonly_pubkey , 32 );
279
311
printf ("Taproot Output %li:\n" , i );
280
312
print_hex (serialized_xonly_pubkey , 32 );
313
+
314
+
315
+ ret = secp256k1_ec_pubkey_serialize (ctx , serialized_pubkey , & len , & plain_outputs [i ], SECP256K1_EC_COMPRESSED );
316
+ assert (ret );
317
+
318
+ printf ("Plain Output %li:\n" , i );
319
+ print_hex (serialized_pubkey , 33 );
281
320
printf ("\n" );
282
321
}
283
322
0 commit comments