> For the complete documentation index, see [llms.txt](/ko/llms.txt).

## Mainnet Conversion

In this section we will go over the steps of converting BTC to rBTC and vice versa in Bitcoin and Rootstock network.

:::tip[Tip]
The minimum amount of Bitcoin to convert is **0.005 BTC** for Mainnet.
:::

### BTC to rBTC conversion

Instructions on how to do a Mainnet peg-in.

### 1. Get a BTC address with balance

- Any Bitcoin wallet that supports legacy (`p2pkh`) private key works for this step. In this section, we use the Electrum BTC wallet for connecting to BTC Mainnet.
  1. Download the wallet from [Electrum Website](https://electrum.org/)
  2. Install Electrum
  3. Start Electrum
  4. Once Electrum starts, create or import a wallet
  5. Go to the third tab "Receive". You will see a Bitcoin Testnet address like below:
  ![Create a Legacy (\`p2pkh\`) walletn](/img/legacy-private-key.png)

> Note: Use a legacy Bitcoin wallet (not Segwit) with a public key beginning with `m` or `n`, and a private key prefixed by `p2pkh`.

### 2. Send Bitcoin to Rootstock Federation address

Send Bitcoin to Rootstock Federation address

- To retrieve the Rootstock Federation address:

  1. Search the bridge contract address [0x0000000000000000000000000000000001000006](https://explorer.rootstock.io/address/0x0000000000000000000000000000000001000006) on the Rootstock Explorer.

  ![Get Federation Address](/img/concepts/rbtc/01-federation-address.png)

  2. Go to Contracts tab --> Read Contracts and scroll to the 8th option which is `getFederationAddress()` and click the Read button.
     It should look like the screenshot below:

  ![Get Federation Address](/img/concepts/rbtc/03-federation-address-mainnet.png)

  Now, you can send Bitcoin to the Federation address via your Bitcoin address.

  > Note: You must send a minimum amount of `0.005 BTC`.

### 3. Wait for BTC confirmations

- To ensure the transaction is successful, we need to wait for 100 BTC network confirmations.

> 100 blocks * 10 minutes/block = 1000 minutes = 16.667 hours. That is, this will take approximately 17 hours.

### 4. Get rBTC address with BTC private key

- You can get a corresponding rBTC address from your BTC private key by using the [Rootstock Utils](https://github.com/rsksmart/utils). If you do not want to compile the utility, you can download the [latest release](https://github.com/rsksmart/utils/releases/latest).

> Note: when entering Bitcoin private key do not include *p2pkh:* in the front.

### 5. Check rBTC balance

You can check balance of rBTC address on Metamask, MyCrypto, or any [Rootstock compatible wallets](https://blog.rootstock.io/noticia/rootstock-wallets/).

> Note: You have to wait a minimum of 100 confirmations + a minimum of 5 minutes for checking your RBTC balance.

### rBTC to BTC conversion

Instructions on how to do a Mainnet peg-out.

### 1. Get BTC address with rBTC private key

You can get a corresponding BTC address from your rBTC private key by using the [Rootstock](https://github.com/rsksmart/utils). If you do not want to compile the utility, you can download the [latest release](https://github.com/rsksmart/utils/releases/latest).

### 2. Send rBTC to Rootstock Bridge Contract

- [Rootstock Bridge Contract address](https://explorer.rootstock.io/address/0x0000000000000000000000000000000001000006): `0x0000000000000000000000000000000001000006`
- Note: The minimum amount to send must be at least `0.004 rBTC` for Mainnet, sending any amount below this, will fail and funds will be reimbursed. The Gas Limit of the transaction needs to be manually set at 100,000 gas; otherwise the transaction will fail. Gas Price can be set to 0.06 gwei (or the gas price suggested by the wallet).
  ![Customize Gas in Metamask before send transaction on Rootstock](/img/metamask-gas-limit.png)

### 3. Check balance of BTC address

- You can either use Electrum wallet downloaded earlier or from any Bitcoin explorer to check the balance.
  > Note: The release process on Bitcoin network takes 4000 Rootstock block confirmations and at least 10 more minutes.

## Testnet Conversion

In this section we will go over the steps of converting t-BTC to tRBTC, and vice versa on the Bitcoin and Rootstock Testnets.

:::tip[Tip]
The minimum amount of Bitcoin to convert is **0.005 tBTC** for Testnet.
:::

### tBTC to tRBTC conversion

Instructions on how to do a Testnet peg-in.

### 1. Connect a wallet to Bitcoin Testnet

We recommend to use Electrum BTC wallet for connecting to Bitcoin Testnet.

- Download the wallet from
  [Electrum Website](https://bitzuma.com/posts/a-beginners-guide-to-the-electrum-bitcoin-wallet/)
- Install Electrum
- Start Electrum in Testnet mode
  - For example on MacOS:
    `/Applications/Electrum.app/Contents/MacOS/Electrum --testnet`
- After Electrum starts, create or import a wallet
- Go to the third tab, "Receive".
  You will see a Bitcoin Testnet address like below.
  ![Create a Legacy (p2pkh) wallet](/img/legacy-private-key.png)
- Note: The Bitcoin wallet needs to be legacy (not Segwit) whose public key starts with either `m` or `n`, and private key starting with `p2pkh:`
  ![Get a Bitcoin Testnet address in Electrum Wallet](/img/electrum-wallet.png)

### 2. Get test Bitcoin from Testnet Faucet

There are a few options to get Bitcoin on Testnet. Use <https://bitcoinfaucet.uo1.net/>.

### 3. Send Bitcoin to Rootstock Federation address

The Rootstock Federation address is retrieved by making a Smart Contract call on Rootstock Testnet.

- To retrieve the Rootstock Federation address:

  1. Search the bridge contract address [0x0000000000000000000000000000000001000006](https://explorer.testnet.rootstock.io/address/0x0000000000000000000000000000000001000006) on the Rootstock Testnet Explorer.

  ![Get Federation Address](/img/concepts/rbtc/01-federation-address.png)

  2. Go to Contracts tab --> Read Contracts and scroll to the 8th option which is `getFederationAddress()` and click the Read button.
     It should look like the screenshot below:

  ![Get Federation Address](/img/concepts/rbtc/02-federation-address-testnet.png)

  Now, you can send Bitcoin to the Federation address via your Bitcoin address.

  > Note: You must send a minimum amount of `0.01 tBTC`.

### 4. Get tRBTC address with tBTC private key

- You can get a corresponding tRBTC address from your tBTC private key by using [github.com/rsksmart/utils](https://github.com/rsksmart/utils). If you do not want to compile the utility, you can download the [latest release](https://github.com/rsksmart/utils/releases/latest).
- Note: When entering Bitcoin private key do not include `_p2pkh:_` in the front.

### 5. Check tRBTC balance on Testnet

- You can check the balance of the above tRBTC address on Metamask, MyCrypto or any Rootstock Testnet compatible wallets.
- You have to wait a minimum of 10 confirmations + a minimum of 5 minutes for checking your RBTC balance.

### tRBTC to tBTC conversion

Instructions on how to do a Testnet peg-out.

:::info[Note]
The release process on Bitcoin network takes 10 Rootstock block confirmations and at least 10 more minutes.
:::

### 1. Get tBTC address with tRBTC private key

- You can get a corresponding tBTC address from your tRBTC private key by using [github.com/rsksmart/utils](https://github.com/rsksmart/utils). If you do not want to compile the utility, you can download the [latest release](https://github.com/rsksmart/utils/releases/latest).

### 2. Send tRBTC to Rootstock Bridge Contract

- [Rootstock Bridge Contract address](https://explorer.testnet.rootstock.io/address/0x0000000000000000000000000000000001000006): `0x0000000000000000000000000000000001000006`
- **Important note**: The minimum amount to send must be **at least** 0.004 tRBTC for Testnet, values below that will be rejected and reimbursed to the sender.
- Gas Limit of the transaction needs to be manually set at 100,000 gas; otherwise the transaction will fail.
- Gas Price can be set to 0.06 gwei.
  ![Customize Gas in Metamask before send transaction on Rootstock](/img/metamask-gas-limit.png)

### 3. Check balance of tBTC address on Bitcoin Testnet

You can either use Electrum wallet downloaded earlier or from
any Bitcoin explorer to check the balance.
