How to build, sign and broadcast Coinswap txs via API


To support DeFi functionalities, we introduced the HTLC and Coin Swap modules in v0.16, so that users can swap tokens between different blockchains and trade them in a decentralized manner.

Coin Swap API

You can preview and try the coin swap apis on the Nyancat Testnet

  • Rule of the liquidity id: uni:Non-IRIS-Token, e.g. uni:btc
  • The POST APIs are only used to build unsigned txs

Add Liquidity Example

This example will show you how to build, sign and broadcast the "add liquidity" tx on the Nyancat Testnet

Query Current Exchange Rate

Open the Coinswap Demo Web App

Build Unsigned Tx

Open the Nyancat LCD API Document


iriscli tx sign unsigned.json --name=<key-name> --chain-id=nyancat-5  > signed.json


iriscli tx broadcast signed.json --commit

great post! Can you give another post about HTLC like this?