Skip to content

Generate random preimage and payment hash for LN invoice. #49

@kannapoix

Description

@kannapoix

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions