A contract that can handle multiple "HTLCs" -- in the sense that these are just values parked at the contract that can be claimed by anyone with the correct preimage during some time. After the expiration time they can then be claimed by another different preimage.
- method: open
- satoshis: the number of satoshis sent is the total that will be locked
- returns:
{expires, preimage, withdraw_preimage}
- payload:
{
"hash": <a string representing the hex-encoded sha256 hash of a preimage you control so you can use it later> -- optional, if not given a random preimage and hash will be generated and returned back to caller
"timelock": <a number of seconds> -- optional, if not given the timelock will be 5 days
"withdraw_hash" <same as "hash" above, this will be only usable after the timelock has expired> -- optional, as "hash" above
}
- method: claim
- satoshis: 0
- returns:
{ok, amount, hash}
- payload:
{
"hash": <a string that identifies the HTLC>
"preimage": <preimage used to claim> -- if the HTLC is expired this should be the preimage corresponding to the "withdraw_hash", otherwise corresponding to the "hash"
"_invoice": <bolt11 invoice to be paid with the full amount of funds in the HTLC>
}