?> All guides here are also applicable to Kintsugi and any Interlay or Kintsugi testnet.
Bridging BTC to the Interlay network is done in four high-level steps:
Precondition: a Vault has locked collateral as described in the Vault Registry.
- A user executes the
requestIssuefunction to open an issue request on the Interlay chain. The issue request includes the amount of iBTC the user wants to issue, the selected Vault, and a collateral reserve to prevent [Griefing: https://spec.interlay.io/security_performance/xclaim-security.html#griefing). - A user sends the equivalent amount of BTC to issue to the Vault on the Bitcoin blockchain.
- The user or Vault acting on behalf of the user extracts a transaction inclusion proof of that locking transaction on the Bitcoin blockchain. The user or a Vault acting on behalf of the user executes the
executeIssuefunction on the Interlay chain. If the function completes successfully, the user receives the requested amount of interBTC into his account. - Optional: If the user is not able to complete the issue request within the predetermined time frame (
IssuePeriod), the Vault is able to call thecancelIssuefunction to cancel the issue request and will receive the griefing collateral locked by the user.
In more detail, an issue request can take the following states from the perspective of the [UI: https://github.com/interlay/interbtc-ui/), [lib: https://github.com/interlay/interbtc-api), and the [squid caching layer: https://github.com/interlay/interbtc-squid):
enum IssueStatus {
Completed,
Cancelled,
Expired,
PendingWithBtcTxNotFound,
PendingWithBtcTxNotIncluded,
PendingWithTooFewConfirmations,
PendingWithEnoughConfirmations,
}?> For the Interlay chain issue request status mapping, please refer to the [spec: https://spec.interlay.io/spec/issue.html).
The states are mapped to a more fine-grained process as follows. This is an extension to the high-level steps above.
- A user requests to mint iBTC by reserving the Vault's collateral on the Interlay chain. Each issue requests starts with
PendingWithBtcTxNotFound. - User sends BTC to a [uniquely generated address: https://spec.interlay.io/security_performance/xclaim-security.html#unique-addresses-via-on-chain-key-derivation) of the Vault.
a. When the BTC transaction is just sent and is still in the Bitcoin mempool, the status of the issue request is PendingWithBtcTxNotIncluded
b. When the BTC transaction is included in a Bitcoin block AND the Bitcoin block is already included in the BTC-Relay on the Interlay chain, but either the BTC transaction OR the BTC block in the BTC-Relay do not have enough confirmations, the issue status is PendingWithTooFewConfirmations.
c. When the BTC transaction is included with sufficient Bitcoin confirmations AND the BTC block has sufficient parachain confirmations, then the issue status is PendingWithEnoughConfirmations.
d. At this point, the issue request can be executed.
- Someone executes the issue request by submitting a Bitcoin transaction inclusion proof to the Interlay chain within the time limit.
a. If the BTC amount sent by the user matches OR is higher than the requested amount in the original issue request, anyone (user or Vault) can execute the request. In most cases, the Vault will automatically execute the request. However, the user can at manually execute the request as well. The issue status is changed to Completed.
b. If the BTC amount sent bny the user is less than the request amount in the original issue request, the user MUST execute the request. If the user executes the request, the issue request status changes to Completed.
- Optional: If nobody executes the issue requests within the time limit, the Vault will cancel the issue request, taking the user's griefing collateral and thereby setting the issue request status to
Cancelled.
a. If a Vault has sufficient capacity AND a user manually executes the issue request with a valid Bitcoin transaction inclusion proof, the issue request status is changed to Completed.
Bridging BTC from the Interlay network is done in four high-level steps:
Precondition: a user owns iBTC.
- A user locks an amount of iBTC by calling the
requestRedeemfunction. In this function call, the user selects a vault to execute the redeem request from the list of Vaults. The function creates a redeem request with a unique hash. - The selected Vault listens for the
RequestRedeemevent emitted from the Interlay chain by the user. The Vault then proceeds to transfer BTC to the address specified by the user in therequestRedeemfunction [including a unique hash in the OP_RETURN: https://spec.interlay.io/security_performance/xclaim-security.html#op-return) of one output. - The vault executes the
executeRedeemfunction by providing the Bitcoin transaction from step 2 together with the redeem request identifier within the [time limit: https://spec.interlay.io/spec/redeem.html#redeemperiod). If the function completes successfully, the locked iBTC are destroyed and the user received its BTC. - Optional: If the user could not receive BTC within the given time (as required in step 3), the user calls
cancelRedeemafter the redeem time limit. The user can choose either to reimburse or to retry:
a. Reimbursement: the user forwards the iBTC tokens to the Vault and receives collateral in exchange of the same value as the burned iBTC. The user also gets a [punishment fee: https://spec.interlay.io/spec/fee.html#punishmentfee) based on the requested redeem amount paid in the collateral of the Vault.
b. Retry: the user gets back its iBTC. The user also gets a [punishment fee: https://spec.interlay.io/spec/fee.html#punishmentfee) based on the requested redeem amount paid in the collateral of the Vault.
- Optional: If during a
cancelRedeemthe user selects reimbursement AND as a result the Vault falls below the [SecureCollateralThreshold: https://spec.interlay.io/spec/vault-registry.html#securecollateralthreshold), then the Vault does not receive the user’s tokens - they are burned, and the Vault’sissuedTokensdecreases. When, at some later point, the Vault gets sufficient collateral, it can callmintTokensForReimbursedRedeemto get the previously burned iBTC.
In more detail, an redeem request can take the following states from the perspective of the [UI: https://github.com/interlay/interbtc-ui/), [lib: https://github.com/interlay/interbtc-api), and the [squid caching layer: https://github.com/interlay/interbtc-squid):
enum RedeemStatus {
Completed,
Expired,
Reimbursed,
Retried,
PendingWithBtcTxNotFound,
PendingWithBtcTxNotIncluded,
PendingWithTooFewConfirmations,
PendingWithEnoughConfirmations,
}?> For the Interlay chain redeem request status mapping, please refer to the [spec: https://spec.interlay.io/spec/redeem.html).
The states are mapped to a more fine-grained process as follows. This is an extension to the high-level steps above.
- A user locks an amount of iBTC by calling the
requestRedeemfunction. In this function call, the user selects a vault to execute the redeem request from the list of Vaults. The function creates a redeem request with a unique hash. Each redeem request starts withPendingWithBtcTxNotFound. - The selected Vault listens for the
RequestRedeemevent emitted from the Interlay chain by the user. The Vault then proceeds to transfer BTC to the address specified by the user in therequestRedeemfunction including a unique hash in the OP_RETURN of one output.
a. When the BTC transaction is just sent and is still in the Bitcoin mempool, the status of the redeem request is PendingWithBtcTxNotIncluded
b. When the BTC transaction is included in a Bitcoin block AND the Bitcoin block is already included in the BTC-Relay on the Interlay chain, but either the BTC transaction OR the BTC block in the BTC-Relay do not have enough confirmations, the redeem status is PendingWithTooFewConfirmations.
c. When the BTC transaction is included with sufficient Bitcoin confirmations AND the BTC block has sufficient Interlay chain confirmations, then the redeem status is PendingWithEnoughConfirmations.
d. At this point, the redeem request can be executed.
3. The vault executes the executeRedeem function by providing the Bitcoin transaction from step 2 together with the redeem request identifier within the time limit. If the function completes successfully, the locked iBTC are destroyed and the user received its BTC. The redeem request status is Confirmed.
4. Optional: If the user could not receive BTC within the given time (as required in step 3), the user calls cancelRedeem after the redeem time limit. The redeem request status is set to Expired. The user can choose either to reimburse or to retry:
a. Reimbursement: the user forwards the the iBTC tokens to the Vault and receives collateral in exchange of the same value as the burned iBTC. The user also gets a punishment fee based on the requested redeem amount paid in the collateral of the Vault. The redeem request status is set to Reimbursed.
b. Retry: the user gets back its iBTC. The user also gets a punishment fee based on the requested redeem amount paid in the collateral of the Vault. The redeem request status is set to Retried.