# MetaMask & DeFi

## I. **Preparation**

1\. [Firmware](https://keyst.one/firmware?locale=en) version M-5.0 (Multi-Cion) running on Keystone Essential or Pro.

&#x20;   (Please read[ How to upgrade firmware](https://support.keyst.one/getting-started/firmware-upgrading) for more details.)

2\. Bind MetaMask extension V10.8.0 or newer with the Keystone Hardware Wallet ([Tutorial](https://support.keyst.one/3rd-party-wallets/eth-and-web3-wallets-keystone/bind-metamask-with-keystone)).

3\. Uniswap: <https://app.uniswap.org/#/swap>.

## **II. Connect Uniswap to "MetaMask** Extensio&#x6E;**”**

1\. Visit Uniswap website: <https://app.uniswap.org/#/swap>. Switch to the \[Swap] tab and click \[Connect wallet].

<figure><img src="/files/rwOjxkqBgUFZRBfUSKpQ" alt="Keystone-MetaMask-DeFi-1"><figcaption></figcaption></figure>

2\. Select \[MetaMask] as your wallet, Then click \[Next] to connect.

<figure><img src="/files/9rYp2JtTtP3hoNEAQdsc" alt="Keystone-MetaMask-DeFi-2"><figcaption></figcaption></figure>

<figure><img src="/files/leeKPIDZE95rVI8tKFr6" alt="Keystone-MetaMask-DeFi-3"><figcaption></figcaption></figure>

3\. Uniswap should now be successfully connected with your MetaMask (Keystone account).

<figure><img src="/files/hdnpD8IuT6MsLHSMpSrx" alt="Keystone-MetaMask-DeFi-4"><figcaption></figcaption></figure>

## **III. Swap from ETH to Tokens (e.g. USDT)**

1\. Select a Token (e.g. USDT) and set the amount you want to swap, then click \[Swap].

<figure><img src="/files/6v3aZGsIXq1jUYebFAna" alt="Keystone-MetaMask-DeFi-5"><figcaption></figcaption></figure>

2\. Confirm the transaction details and click \[Confirm Swap].

<figure><img src="/files/KDJeek7b8bNhqgx9AoIW" alt="Keystone-MetaMask-DeFi-6"><figcaption></figcaption></figure>

3\. Click \[Confirm] on MetaMask Extension to get the unsigned transaction data in QR code format.

<figure><img src="/files/e4GmnPY6g9Q4ELCSJWu5" alt="Keystone-MetaMask-DeFi-7"><figcaption></figcaption></figure>

4\. Keystone: Touch the “Scan” icon and scan the QR code shown on MetaMask Extension.

<figure><img src="/files/bBWgjXpyEtaDA4SKLlxD" alt="Keystone-MetaMask-DeFi-8"><figcaption></figcaption></figure>

5\. Confirm the transaction details on Keystone Hardware Wallet. Touch \[Sign] and enter the password to verify. Get the signed transaction data in QR code format.

<figure><img src="/files/fmw8YCsVhD5w4ibSx2yT" alt="Keystone-MetaMask-DeFi-9"><figcaption></figcaption></figure>

6\. Click \[Get Signature] on MetaMask Extension and scan the QR code shown on the Keystone device.

<figure><img src="/files/VPFLb8xvPjmATFnLLprw" alt="Keystone-MetaMask-DeFi-10"><figcaption></figcaption></figure>

7\. Transaction submitted automatically after the scanning is finished.

<figure><img src="/files/-MbFl3tR6CQDOnAsh-M6" alt="Keystone-MetaMask-DeFi-11"><figcaption></figcaption></figure>

## **IV. Swap from Tokens to ETH/Tokens**

### 1. Approve

If it is the first time you are swapping from Token A to ETH or Token B, you will be required to authorize \[Approve] the third party (e.g. the smart contract of Token A) to spend Token A in your wallet before you can \[Swap].

1\) Uniswap: Select the coin type and set the amount you want to swap. Click \[Approve]. Then click \[Confirm] on MetaMask Extension to get the unsigned transaction data in QR code format.

<figure><img src="/files/Oe9oNROHNPBxfI2hsKxs" alt="Keystone-MetaMask-DeFi-12"><figcaption></figcaption></figure>

2\) On Keystone: Touch the “scan” icon and scan the QR code that is shown on MetaMask Extension. Confirm the transaction details on Keystone. Touch \[Sign] and enter your password/fingerprint to verify. It will then show the signed transaction data in QR code format.

<figure><img src="/files/yoCTISCjhdBBBOpFGVJA" alt="Keystone-MetaMask-DeFi-13"><figcaption></figcaption></figure>

3\) Click \[Get Signature] on MetaMask Extension and scan the QR code shown on the Keystone device to broadcast the transaction.

<figure><img src="/files/wTgazlhswTFsVawrr5M2" alt="Keystone-MetaMask-DeFi-14"><figcaption></figcaption></figure>

### 2. Swap

The process of “Swap from Tokens to ETH / Tokens” is the same as the one of “Swap from ETH to Tokens”. The only difference is the methods of calling contracts.

<figure><img src="/files/ND6aSOYqkNnhQaNZlMt3" alt="Keystone-MetaMask-DeFi-15"><figcaption></figcaption></figure>

## **V. Add Liquidity (e.g. ETH + UNI)**

This part of the tutorial will explain how to add V2 liquidity on the Rinkeby testnet as an example. And the process of "add liquidity" on mainnet is the same as on testnet.

### 1. Approve

If it is the first time you are adding liquidity to a pair, you will be required to click \[Approve] to authorize the third party (e.g. the smart contract of Token A) to spend Token A in your wallet before you can \[Supply].

1\) Switch to the “Pool” tab on Uniswap. Click \[More] > \[V2 Liquidity ] > \[Add V2 Liquidity].

<figure><img src="/files/10TsB5Ny7GBuwveZlJKK" alt="Keystone-MetaMask-DeFi-16"><figcaption></figcaption></figure>

<figure><img src="/files/uLRsvgqTmAsUCABf6kzO" alt="Keystone-MetaMask-DeFi-17"><figcaption></figcaption></figure>

2\) Select the coin type and set the amount you want to supply. Then click \[Approve UNI].

&#x20;   (Tip: You can set fee tier and price range yourself If you are adding V3 liquidity).

<figure><img src="/files/uRepqzQZr5O9nG66I88q" alt="Keystone-MetaMask-DeFi-18"><figcaption></figcaption></figure>

3\) Click \[Confirm] on MetaMask Extension to get the unsigned transaction data in QR code format.

<figure><img src="/files/sZkOszkO5cohTXvhKIHS" alt="Keystone-MetaMask-DeFi-19"><figcaption></figcaption></figure>

4\) Keystone Hardware Wallet: Touch the “scan” icon and scan the QR code shown on MetaMask Extension.

<figure><img src="/files/EqY1PWp3x5b3BK2HgsHe" alt="Keystone-MetaMask-DeFi-20"><figcaption></figcaption></figure>

5\) Confirm the transaction details on the Keystone device. Touch \[Sign] and enter a password or fingerprint to verify. This will then show the signed transaction data in QR code format.

<figure><img src="/files/OIEWI0c6NFIP56hJQbP3" alt="Keystone-MetaMask-DeFi-21"><figcaption></figcaption></figure>

6\) Click \[Get Signature] on MetaMask Extension and scan the QR code shown on Keystone device.

<figure><img src="/files/3Bf6ql7mpu9cD1ve31wA" alt="Keystone-MetaMask-DeFi-22"><figcaption></figcaption></figure>

7\) The transaction will be submitted automatically after the scanning has finished.

<figure><img src="/files/radpgEHRvaYkehTPM8o3" alt="Keystone-MetaMask-DeFi-23"><figcaption></figcaption></figure>

### 2. Supply

1\) Once the approving transaction is confirmed, click \[Supply].

<figure><img src="/files/U73HEDiXaxGrjrpKNkqJ" alt="Keystone-MetaMask-DeFi-24"><figcaption></figcaption></figure>

2\) Confirm the transaction details and click \[Confirm Supply].

<figure><img src="/files/V5NtcMhEVEz51clqIH4I" alt="Keystone-MetaMask-DeFi-25"><figcaption></figcaption></figure>

3\) Click \[Confirm] on MetaMask Extension to get the unsigned transaction data in QR code format.

<figure><img src="/files/EeWpTb9wAr3R6p2GRUQi" alt="Keystone-MetaMask-DeFi-26"><figcaption></figcaption></figure>

4\) Keystone Hardware Wallet: Touch the “Scan” icon and scan the QR code shown on MetaMask Extension.

<figure><img src="/files/OzCiG92yEOzYlETary81" alt="Keystone-MetaMask-DeFi-27"><figcaption></figcaption></figure>

5\) Confirm the transaction details on the Keystone device. Touch \[Sign] and enter your password or fingerprint to verify. The device will then show the signed transaction data in QR code format.

<figure><img src="/files/mN3g9InJOPIguM5JEoWI" alt="Keystone-MetaMask-DeFi-28"><figcaption></figcaption></figure>

6\) Click \[Get Signature] on MetaMask Extension and scan the QR code shown on the Keystone device.

<figure><img src="/files/WVB9FQI1gOaI4u5ZTjg6" alt="Keystone-MetaMask-DeFi-29"><figcaption></figcaption></figure>

7\) The transaction is submitted automatically after the scanning has finished.

<figure><img src="/files/cwJ8UCBgALuS5Yu7FQyh" alt="Keystone-MetaMask-DeFi-30"><figcaption></figcaption></figure>

## **VI. Remove Liquidity**

This part of the tutorial will explain how to remove liquidity on the Rinkeby testnet as an example. And the process of "remove liquidity" on mainnet is the same as on testnet.

### 1. Approve

If it is the first time you are removing the liquidity of a given liquidity pair, you will be required to click \[Approve] to authorize the third party (e.g. the smart contract of Token A) to spend Token A in your wallet before you can \[Remove] liquidity.

1\) Switch to the “Pool” tab on Uniswap. Click \[Manage] -> \[Remove].

<figure><img src="/files/W7dv8TR7x0pnPMNh4wXo" alt="Keystone-MetaMask-DeFi-31"><figcaption></figcaption></figure>

2\) Set the amount and click \[Approve].

<figure><img src="/files/1rl5uWGyuXHOTFE3v5aA" alt="Keystone-MetaMask-DeFi-33"><figcaption></figcaption></figure>

3\) Click \[SIGN] on MetaMask Extension to get the unsigned message in QR code format.

<figure><img src="/files/3Im2Rfw50ACXXfd5IuFa" alt="Keystone-MetaMask-DeFi-34"><figcaption></figcaption></figure>

4\) Keystone Hardware Wallet: Touch the “scan” icon and scan the QR code shown on MetaMask Extension.

<figure><img src="/files/3MNxk5hxLAD3FGJAYIDq" alt="Keystone-MetaMask-DeFi-35"><figcaption></figcaption></figure>

5\) Confirm the message on the Keystone device. Touch \[Sign] and enter your password or fingerprint to verify. After signing, you will then receive the sign message in a QR code format.

<figure><img src="/files/71z4EmW9RW1ehu2w4gdC" alt="Keystone-MetaMask-DeFi-36"><figcaption></figcaption></figure>

6\) Click \[Get Signature] on MetaMask Extension and scan the QR code shown on your Keystone device.

<figure><img src="/files/17s6P0NAmNKtpvmrj6Db" alt="Keystone-MetaMask-DeFi-37"><figcaption></figcaption></figure>

7\) Approval has been completed.

<figure><img src="/files/Z8R0kkU3bibeqsgaByy9" alt="Keystone-MetaMask-DeFi-38"><figcaption></figcaption></figure>

### 2. Remove

1\) Once the approval is completed, click \[Remove].

<figure><img src="/files/yElTzyJmEFeuy6GyOW1v" alt="Keystone-MetaMask-DeFi-39"><figcaption></figcaption></figure>

2\) Confirm the transaction details and click \[Confirm].

<figure><img src="/files/zOWesspLuB4JE1ml2bnA" alt="Keystone-MetaMask-DeFi-40"><figcaption></figcaption></figure>

3\) Click \[Confirm] on MetaMask Extension to get the unsigned message in QR code format.

<figure><img src="/files/3d2hH6Loet3Cv57nFowI" alt="Keystone-MetaMask-DeFi-41"><figcaption></figcaption></figure>

4\) Keystone Hardware Wallet: Touch the “Scan” icon and scan the QR code shown on MetaMask Extension.

<figure><img src="/files/6WsicddhTa5QtLUyESzo" alt="Keystone-MetaMask-DeFi-42"><figcaption></figcaption></figure>

5\) Confirm the transaction data on your Keystone device. Touch \[Sign] and enter your password or fingerprint to verify. The device will then show the signed transaction data in QR code format.

<figure><img src="/files/Isgvb0qHQPbjS1pWR7pH" alt="Keystone-MetaMask-DeFi-43"><figcaption></figcaption></figure>

6\) Click \[Get Signature] on MetaMask Extension and scan the QR code shown on your Keystone device.

<figure><img src="/files/aGhix9upPewdfdcG2GXi" alt="Keystone-MetaMask-DeFi-44"><figcaption></figcaption></figure>

7\) The transaction is submitted automatically after the scanning has finished.

<figure><img src="/files/e8EZZsOSCCg3qaoRVOhY" alt="Keystone-MetaMask-DeFi-45"><figcaption></figcaption></figure>

**Instructions recommended:**

{% content-ref url="/pages/-MeTrCm1NbNLC1YuswHl" %}
[Decoding DeFi Transactions](/advanced-features/decode-defi-transactions.md)
{% endcontent-ref %}


---

# 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://support.keyst.one/3rd-party-wallets/eth-and-web3-wallets-keystone/bind-metamask-with-keystone/how-to-use-metamask-keystone-with-defi.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.
