HTLC

HTLC module allows you to manage local Hash Time Locked Contracts (HTLCs) for atomic swaps with other chains.

There are the following states involved in the lifecycle of an HTLC:

  • open: indicates the HTLC is claimable
  • completed: indicates the HTLC has been claimed
  • refunded: indicates the HTLC has been refunded

Available Commands

NameDescription
createCreate an HTLC
claimClaim an opened HTLC
htlcQuery details of an HTLC

iris tx htlc create

Create an HTLC

iris tx htlc create \
    --to=<recipient> \
    --receiver-on-other-chain=<receiver-on-other-chain> \
    --sender-on-other-chain=<sender-on-other-chain> \
    --amount=<amount> \
    --hash-lock=<hash-lock> \
    --secret=<secret> \
    --timestamp=<timestamp> \
    --time-lock=<time-lock> \
    --transfer=<true | false> \
    --from=mykey

Flags:

Name, shorthandTypeRequiredDefaultDescription
--tostringYesBech32 encoding address to receive coins
--receiver-on-other-chainstringThe claim receiving address on the other chain
--sender-on-other-chainstringThe counterparty creator address on the other chain
--amountstringYesSimilar to the amount in the original transfer
--secretstringThe secret for generating the hash lock, generated randomly if omitted
--hash-lockstringThe sha256 hash generated from secret (and timestamp if provided), generated from secret if omitted
--time-lockstringYesThe number of blocks to wait before the asset may be returned to
--timestampuintThe timestamp in seconds for generating hash lock if provided
--transferboolfalseWhether it is an HTLT transaction

iris tx htlc claim

Claim an opened HTLC

iris tx htlc claim [id] [secret] [flags] --from=mykey

iris query htlc htlc

Query details of an HTLC

iris query htlc htlc <id>

iris query htlc params

Query params of HTLC module

iris query htlc params

iris query htlc supplies

Query supplies of all HTLT assets

iris query htlc supplies

iris query htlc supply

Query supply of an HTLT asset

iris query htlc supply [denom]