# Decrypting

Decrypting is the process of converting your confidential FHERC20 balance back into a public ERC20 balance. This process has 2 steps:

1. Decrypting some amount of FHERC20
2. Claiming the decrypted amount as ERC20

{% hint style="info" %}
When converting from a confidential balance to a public balance, we must perform an on-chain decryption using `FHE.decrypt` . In this case, we must use `FHE.decrypt` on the amount of token that has been transferred.

This decryption request is picked up by CoFHE, which will perform the decryption and post the result back on-chain.

This asynchronous on-chain decryption is what forces "Decrypt" and "Claim" to be handled by two separate transactions.
{% endhint %}

### 1. Decrypting FHERC20 Balance

After selecting the FHERC20 token to decrypt and the amount to decrypt, we execute the Decrypt transaction. In [confidentialerc20.sol](https://docs.redact.money/architecture/confidentialerc20.sol "mention") the function `decrypt()` is used, which burns the FHERC20 and requests an on-chain FHE decryption of the amount burned. Once the on-chain FHE decryption is finalized, that amount is marked as "Claimable" and can be claimed as the underlying ERC20 in the upcoming step.

In Redact, this is the expected Decrypt flow:

<div data-full-width="false"><figure><img src="https://3289548442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBtZLqCP6brcfNsL0LJh%2Fuploads%2FLkTYdmERMSaoJCphT38K%2FDecrypt_flow.png?alt=media&#x26;token=7a5363ec-bbb6-4ab2-974d-2a2c6093745b" alt=""><figcaption><p>Decryption flow diagram. (1) Initial, (2) Pending, (3) Success</p></figcaption></figure></div>

TX: [https://sepolia.etherscan.io/tx/0x7a2...a71](https://sepolia.etherscan.io/tx/0x7a29ec13573d1c0f5f11c48a52d8a04d1578800f8f9a7ed7e04fa90ed12f8a71)

After the Decryption transaction has succeeded, you can note that in the wallet the public ERC20 balance has been replaced with two balances: The **public** balance, and the **claimable** balance.

You can claim these decrypted tokens either from the main page component, or from within the wallet using the **CLAIM** button

### 2. Claiming ERC20 Balance

After the successful on-chain FHE decryption has resolved, we are ready to claim the ERC20s. Claiming will add the claimable amount to your ERC20 balance, and in Redact it looks like this:

In order to encrypt (or wrap) your ERC20 tokens, they must first approve them for use in the ConfidentialERC20 smart contract. Only the amount to wrap must be approved.

In the Redact UI, this is step 2 of the wrapping process, and appears like so:

<div data-full-width="false"><figure><img src="https://3289548442-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBtZLqCP6brcfNsL0LJh%2Fuploads%2F9n6AZGfKY06VcsoMPtB8%2Fimage.png?alt=media&#x26;token=78851f95-c0c1-47e9-b967-5bfbc34de1a8" alt=""><figcaption><p>Approval flow diagram. (1) Initial, (2) Pending, (3) Success</p></figcaption></figure></div>

Tx: [https://sepolia.etherscan.io/tx/0x401...cc2](https://sepolia.etherscan.io/tx/0x40101268d1a87e51f89e979298e51732875bae2702885370bc166a99cec41cc2)&#x20;

{% hint style="info" %}
Notice that in the transaction above, it is public LINK that is being transferred during the claim flow.
{% endhint %}

If you would like to read more about claiming take a look here: [#claim-system](https://docs.redact.money/architecture/confidentialerc20.sol#claim-system "mention")
