# Bitcoin Channel

## Commit

## POST /brc20swap/create\_deposit\_psbt

> Construct Bitcoin Channel commit PSBT

```json
{"openapi":"3.0.1","info":{"title":"Backend endpoints","version":"1.0.0"},"tags":[{"name":"dotswap/trading"}],"servers":[{"url":"https://api.dotswap.app","description":"Swap main"},{"url":"https://api-testnet4.dotswap.app","description":"Swap test"}],"paths":{"/brc20swap/create_deposit_psbt":{"post":{"summary":"Construct Bitcoin Channel commit PSBT","deprecated":false,"description":"","tags":["dotswap/trading"],"parameters":[{"name":"Cookie","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Content-Type","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"coin_type":{"type":"string"},"tick":{"type":"string","title":"Token name"},"value":{"type":"string","title":"Commit amount"},"payer_pub_key":{"type":"string","title":"Wallet public key"},"payer_btc_addr":{"type":"string","title":"Wallet btc address","description":"Reserved for xverse wallets; pass the same address twice if using unisat"},"payer_ord_addr":{"type":"string","title":"Wallet ordinal address"},"fee_rate":{"type":"integer","title":"Fee rate"},"inscription_ids":{"type":"array","items":{"type":"string"},"title":"Transfer inscription","description":"Convenient for constructing psbt"},"  is_multi_sign_trade":{"type":"boolean","title":"Whether to commit to Bitcoin Channel"}},"required":["tick","value","payer_btc_addr","payer_ord_addr","fee_rate","inscription_ids","payer_pub_key","coin_type","  is_multi_sign_trade"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","additionalProperties":false},"msg":{"type":"string","additionalProperties":false},"data":{"type":"object","properties":{"psbt":{"type":"string","title":"Base64 psbt","additionalProperties":false},"tx_size":{"type":"integer","title":"Tx size","additionalProperties":false},"ins_contain_sats":{"type":"integer","title":"Sum of input inscription satoshis","additionalProperties":false},"ToSignInputs":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","title":"Vin index","additionalProperties":false},"type":{"type":"string","title":"Address type","description":"Ord: address for storing inscriptions btc: address for storing btc","additionalProperties":false}},"required":["index","type"]}}},"required":["psbt","ToSignInputs","tx_size","ins_contain_sats"]},"req_id":{"type":"string","additionalProperties":false}},"required":["code","msg","data","req_id"]}}}}}}}}}
```

## POST /brc20swap/create\_deposit\_order\_by\_psbt

> Create commit order based on PSBT

```json
{"openapi":"3.0.1","info":{"title":"Backend endpoints","version":"1.0.0"},"tags":[{"name":"dotswap/trading"}],"servers":[{"url":"https://api.dotswap.app","description":"Swap main"},{"url":"https://api-testnet4.dotswap.app","description":"Swap test"}],"paths":{"/brc20swap/create_deposit_order_by_psbt":{"post":{"summary":"Create commit order based on PSBT","deprecated":false,"description":"","tags":["dotswap/trading"],"parameters":[{"name":"Cookie","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Content-Type","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"psbt":{"type":"string","title":"Signed psbt base64"},"tick":{"type":"string","title":"Btc/brc20 name"},"payer_ord_addr":{"type":"string","title":"Ordinal wallet address"},"inscription_ids":{"type":"array","items":{"type":"string"},"title":"Selected inscription id for brc20 commit"},"amount":{"type":"string","title":"Amount","description":"Used to construct records"},"fee_rate":{"type":"string","title":"Fee rate"},"is_multi_sign_trade":{"type":"boolean","title":"Whether to commit to Bitcoin Channel"}},"required":["psbt","tick","payer_ord_addr","amount","fee_rate","is_multi_sign_trade"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"receiver_addr":{"type":"string"},"order_id":{"type":"string"},"txid":{"type":"string"}},"required":["receiver_addr","order_id","txid"]},"req_id":{"type":"string"}},"required":["code","msg","data","req_id"]}}}}}}}}}
```

## POST /brc20swap/deposit\_records

> Commit records

```json
{"openapi":"3.0.1","info":{"title":"Backend endpoints","version":"1.0.0"},"tags":[{"name":"dotswap/trading"}],"servers":[{"url":"https://api.dotswap.app","description":"Swap main"},{"url":"https://api-testnet4.dotswap.app","description":"Swap test"}],"paths":{"/brc20swap/deposit_records":{"post":{"summary":"Commit records","deprecated":false,"description":"","tags":["dotswap/trading"],"parameters":[{"name":"Accept","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Accept-Language","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Connection","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Origin","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Referer","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Sec-Fetch-Dest","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Sec-Fetch-Mode","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Sec-Fetch-Site","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Wallet-Name","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Wallet-Ver","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"sec-ch-ua","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"sec-ch-ua-mobile","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"sec-ch-ua-platform","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Host","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Content-Type","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"page":{"type":"integer"},"page_size":{"type":"integer"},"is_multi_sign_trade":{"type":"boolean","title":"Query Bitcoin Channel commit records"}},"required":["address","page","page_size"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"total":{"type":"integer"},"records":{"type":"array","items":{"type":"object","properties":{"record_type":{"type":"string"},"coin_type":{"type":"string"},"tick":{"type":"string"},"amount":{"type":"string"},"txid":{"type":"string"},"timestamp":{"type":"integer"},"progress":{"type":"string"}},"required":["record_type","coin_type","tick","amount","txid","timestamp","progress"]}}},"required":["total","records"]},"req_id":{"type":"string"}},"required":["code","msg","data","req_id"]}}}}}}}}}
```

## Reclaim

## POST /brc20swap/get\_trading\_withdraw\_psbt

> Construct Bitcoin Channel reclaim PSBT

```json
{"openapi":"3.0.1","info":{"title":"Backend endpoints","version":"1.0.0"},"tags":[{"name":"dotswap/trading_account"}],"servers":[{"url":"https://api.dotswap.app","description":"Swap main"},{"url":"https://api-testnet4.dotswap.app","description":"Swap test"}],"paths":{"/brc20swap/get_trading_withdraw_psbt":{"post":{"summary":"Construct Bitcoin Channel reclaim PSBT","deprecated":false,"description":"","tags":["dotswap/trading_account"],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"coin_type":{"type":"string","title":"Brc20/arc20"},"tick":{"type":"string","title":"Brc20/arc20 tick"},"amount":{"type":"string","title":"Reclaim amount"},"payer_btc_address":{"type":"string","title":"BTC reclaim address"},"payer_ord_address":{"type":"string","title":"Ordinals reclaim address"},"user_public_key":{"type":"string","title":"btc:ord"},"fee_rate":{"type":"integer","title":"Fee rate"}},"required":["coin_type","tick","payer_btc_address","fee_rate","amount","user_public_key","payer_ord_address"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"order_id":{"type":"string","title":"Order id"},"psbt":{"type":"string","title":"Psbt awaiting user signature"}},"required":["psbt","order_id"]}},"required":["code","msg","data"]}}}}}}}}}
```

## POST /brc20swap/submit\_trading\_withdraw\_psbt

> Signed reclaim PSBT for Bitcoin Channel

```json
{"openapi":"3.0.1","info":{"title":"Backend endpoints","version":"1.0.0"},"tags":[{"name":"dotswap/trading_account"}],"servers":[{"url":"https://api.dotswap.app","description":"Swap main"},{"url":"https://api-testnet4.dotswap.app","description":"Swap test"}],"paths":{"/brc20swap/submit_trading_withdraw_psbt":{"post":{"summary":"Signed reclaim PSBT for Bitcoin Channel","deprecated":false,"description":"","tags":["dotswap/trading_account"],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"order_id":{"type":"string","title":"Order id"},"psbt":{"type":"string","title":"Signed psbt"},"is_base64":{"type":"boolean"}},"required":["order_id","psbt","is_base64"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"ID":{"type":"integer"},"OrderId":{"type":"string"},"FeeTxid":{"type":"string"},"FeeAmount":{"type":"integer"},"FeeReceiveAddr":{"type":"string"},"FeeRate":{"type":"integer"},"FeePayMethod":{"type":"string"},"Txid":{"type":"string"},"SenderAddr":{"type":"string"},"ReceiverAddr":{"type":"string"},"Amount":{"type":"string"},"CoinType":{"type":"string"},"Tick":{"type":"string"},"Status":{"type":"string"},"ErrMsg":{"type":"string"},"CreatedAtSec":{"type":"integer"},"UpdatedAtSec":{"type":"integer"}},"required":["ID","OrderId","FeeTxid","FeeAmount","FeeReceiveAddr","FeeRate","FeePayMethod","Txid","SenderAddr","ReceiverAddr","Amount","CoinType","Tick","Status","ErrMsg","CreatedAtSec","UpdatedAtSec"]},"req_id":{"type":"string"}},"required":["code","msg","data","req_id"]}}}}}}}}}
```

## POST /brc20swap/withdraw\_records

> Reclaim records

```json
{"openapi":"3.0.1","info":{"title":"Backend endpoints","version":"1.0.0"},"tags":[{"name":"dotswap/trading"}],"servers":[{"url":"https://api.dotswap.app","description":"Swap main"},{"url":"https://api-testnet4.dotswap.app","description":"Swap test"}],"paths":{"/brc20swap/withdraw_records":{"post":{"summary":"Reclaim records","deprecated":false,"description":"","tags":["dotswap/trading"],"parameters":[{"name":"Accept","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Accept-Language","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Connection","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Origin","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Referer","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Sec-Fetch-Dest","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Sec-Fetch-Mode","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Sec-Fetch-Site","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"User-Agent","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Wallet-Name","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Wallet-Ver","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"sec-ch-ua","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"sec-ch-ua-mobile","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"sec-ch-ua-platform","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Host","in":"header","description":"","required":true,"schema":{"type":"string"}},{"name":"Content-Type","in":"header","description":"","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"page":{"type":"integer"},"page_size":{"type":"integer"},"is_multi_sign_trade":{"type":"boolean","title":"Query Bitcoin Channel reclaim records"}},"required":["address","page","page_size"]}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer"},"msg":{"type":"string"},"data":{"type":"object","properties":{"total":{"type":"integer"},"records":{"type":"array","items":{"type":"object","properties":{"record_type":{"type":"string"},"coin_type":{"type":"string"},"tick":{"type":"string"},"amount":{"type":"string"},"txid":{"type":"string"},"timestamp":{"type":"integer"},"progress":{"type":"string"}},"required":["record_type","coin_type","tick","amount","txid","timestamp","progress"]}}},"required":["total","records"]},"req_id":{"type":"string"}},"required":["code","msg","data","req_id"]}}}}}}}}}
```

{% hint style="warning" %}
Note: For all the endpoints related to the Bitcoin Channel mentioned above, the parameter `is_multi_sign_trade` must be set to `true`.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.on.nexus/dotswap/developers/market-data-and-feeds/trading/bitcoin-channel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
