hal icon indicating copy to clipboard operation
hal copied to clipboard

Generate random preimage and payment hash for LN invoice.

Open kannapoix opened this issue 1 year ago • 0 comments

I want a option to generate a set of random preimage and payment hash. With current hal, I can do it, but it become a bit complex combination.

preimage=$(hal random bytes 32); echo $preimage; hal hash sha256 $preimage

I'm happy if we have a option like...

$ hal random payment-hash
{
  "preimage": "489b3c3e964c7dbfcf8826804494230560e15863bae518079787a3695c271fe0",
  "payment_hash": "3a368ab017ab789ad16d52637597253eafd327d604f25be9faeec0ba7887177c"
}

or

$ hal ln invoice gen-payment-hash
{
  "preimage": "489b3c3e964c7dbfcf8826804494230560e15863bae518079787a3695c271fe0",
  "payment_hash": "3a368ab017ab789ad16d52637597253eafd327d604f25be9faeec0ba7887177c"
}

or, many other interfaces are possible.

Is it reasonable to add this kind of option to hal? If it is, I would like to work on implementing it after we discuss the interface details.

kannapoix avatar May 04 '24 08:05 kannapoix