Keystone Support
Official WebsiteCoin SupportBlogContact Us
English
English
  • 🧰Advice and Answers from Keystone Team
  • General Navigation Guide
  • About Keystone
  • ChangeLog
    • Keystone Firmware (Multi-Coin)
      • M-13.0(Multi-Coin)
      • M-12.6 (Multi-Coin)
      • M-12.4 (Multi-Coin)
      • M-12.2 (Multi-Coin)
      • M-12.0(Multi-Coin)
      • M-11.0(Multi-Coin)
      • M-10.8(Multi-Coin)
      • M-10.6(Multi-Coin)
      • M-10.4(Multi-Coin)
      • M-10.2(Multi-Coin)
      • M-10.0(Multi-Coin)
      • M-9.6(Multi-Coin)
      • M-9.4(Multi-Coin)
      • M-9.2(Multi-Coin)
      • M-8.8(Multi-Coin)
      • M-8.4(Multi-Coin)
      • M-8.2(Multi-Coin)
      • M-8.0 (Multi-Coin)
      • M-7.2 (Multi-Coin)
      • M-7.0 (Multi-Coin)
      • M-6.10 (Multi-Coin)
      • M-6.8 (Multi-Coin)
      • M-6.6 (Multi-Coin)
      • M-6.4 (Multi-Coin)
      • M-6.2 (Multi-Coin)
      • M-6.0 (Multi-Coin)
      • M-5.4 (Multi-Coin)
      • M-5.3 (Multi-Coin)
      • M-5.2 (Multi-Coin)
      • M-5.0 (Multi-Coin)
      • V 1.4.2 (Multi-Coin)
      • V 1.4.0 (Multi-Coin)
      • V 1.3.0 (Multi-Coin)
      • V 1.2.0 (Multi-Coin)
      • V 1.1.0 (Multi-Coin)
    • Keystone Firmware (BTC-Only)
      • B-3.6 (BTC-Only)
      • B-3.4 (BTC-Only)
      • B-3.2 (BTC-Only)
      • B-2.5 (BTC-Only)
      • B-2.0 (BTC-Only)
      • V 1.1.1 (BTC-Only)
    • Keystone Companion App
      • V1.2.3
      • V1.2.2
      • V1.2.1
      • V 1.1.2
      • V 1.1.0
      • ERC-20 Token Delisting
  • Getting Started
    • Setting Up Keystone (Legacy)
    • Setting Up Keystone (New)
    • Firmware Upgrade
      • How to Format a MicroSD Card to FAT32?
      • Verify the SHA256 Checksum of the Firmware Update File
    • Getting Started with M-10.0 or newer for Beginners
    • Keystone Mobile App Syncing
    • Receiving Cryptocurrency
    • Sending Cryptocurrency
  • Basic Features
    • Password
      • Setting Pattern Lock
      • Fingerprint Settings(Pro only)
      • Forgot or Reset a Password or Pin
    • Add Multiple Addresses
    • Add Tokens on the Mobile APP
    • Add labels to Address
    • View Transaction Details
    • Set System Settings
    • Wipe the Device
  • 3rd Party Integrations
    • Bitcoin Wallets
      • Casa
      • Enhance the security of BlueWallet
        • BlueWallet 2/3 PSBT Multi-sig: BlueWallet + Keystone + ColdCard
        • BlueWallet 2/3 PSBT Multi-sig: Keystone + ColdCard + SeedPicker
      • Specter
        • Specter 2/2 PSBT Multi-Sig
        • Specter 2/3 PSBT Multi-Sig
      • Sparrow Wallet
        • Sparrow Wallet 2/3 PSBT Multi-sig
      • Electrum
        • Electrum 2/2 PSBT Multi-sig
        • Electrum 2/3 PSBT Multi-sig
      • Wasabi Wallet
      • BTCPay Server
      • Nunchuk
      • Simple Bitcoin Wallet
    • ETH & Web3 Wallets
      • MetaMask
        • MetaMask & DeFi
        • Importing MetaMask Wallet into Keystone
        • Potential Trouble with Importing MetaMask wallet into Keystone
        • Importing Your Ledger Wallet/Account into Your Keystone Hardware Wallet
        • How to Switch ETH Path to Ledger Live / Legacy Format?
        • Configure EVM Chains on MetaMask
      • MetaMask Mobile
        • Defi with MetaMask Mobile
        • Configuring EVM Chains on MetaMask Mobile
      • OKX Wallet (Extension)
      • OKX Wallet Mobile
      • Bitget
      • Rabby Wallet
      • Core Wallet (Extension)
      • BlockWallet
      • Polkadot{.js} (DOT/KSM)
        • DOT/KSM Staking
    • Aptos Wallets
      • Fewcha Wallet (Extension)
      • Petra Aptos Wallet (Extension)
    • Arweave Wallets
      • 🦔ArConnect
    • Cosmos Wallets
      • Keplr (Extension)
        • How to Make IBC Transfers with Keystone
    • NEAR Wallets
      • Sender Wallet (Extension)
      • How to switch Near Path to Ledger format?
    • Polkadot Wallets
      • SubWallet
      • Metadata Update or Reset
    • Solana Wallets
      • Solflare Extension
      • Solflare Mobile
    • Dapp (DeFi)
      • Safe
      • Safe Mobile App
      • Zapper
      • Yearn Finance
      • SushiSwap
    • Other Coins
      • XRP Toolkit (XRP)
  • Advanced Features
    • Displaying Your NFT on the Lock Screen
    • Three BTC Address Formats Support
    • Change the derivation path of addresses
    • Export XPUB
    • Displaying ENS Names
    • Multi Signature
      • Delete Multisig Wallet
    • Staking
    • Decoding DeFi Transactions
    • Decoding Multi-Signature Transactions
    • Decoding 4-byte Function Signature
    • Recovery Phrase
      • Construct Your Own Recovery Phrase
      • Import or Create Shamir Backup
      • Use Dice to Generate Recovery Phrase
      • Recovery Phrase Check
      • Recover your Ledger Wallet
    • Passphrase
    • Self-Destruct Mechanism (Pro-only)
  • Miscellaneous
    • Security Practices
    • FAQ
    • Cobo Vault Companion App
    • Migrating from the Keystone Companion App to OKX: A Step-by-Step Guide
  • Keystone Tablet
    • Keystone Tablet Instruction Guide
    • Why does the Keystone Tablet have only 4 slots for a word?
Powered by GitBook
On this page
  • I. What is an ABI?
  • II. Why did we implement this?
  • III. Keystone's Solution
  • A. Preparation
  • B. Decoding DeFi Transactions
  • IV. Advanced Operation

Was this helpful?

  1. Advanced Features

Decoding DeFi Transactions

PreviousStakingNextDecoding Multi-Signature Transactions

Last updated 1 year ago

Was this helpful?

I. What is an ABI?

An ABI (application binary interface) is an interface that obtains information between two binary program modules. In the Ethereum ecosystem, an ABI is like a “tool” that decodes DeFi transactions.

For more information, visit our blog.

II. Why did we implement this?

Keystone’s vision and mission has always been to make transactions more secure and reliable.

In light of the needs of DeFi projects and the potential consequences of blind signing, Keystone has developed a function of implementing an ABI on a microSD card to decode DeFi transactions. Our blog explains this feature in detail and also contains a follow-up development plan.

III. Keystone's Solution

Firmware versions V1.3.0 (Multi-Coin) or newer supports the decoding of DeFi transactions using ABI via a microSD card.

A. Preparation

1. Firmware version V1.3.0 (Multi-Cion) or newer running on Keystone Essential or Pro.

(Please see firmware upgrade on for more help.)

Important Note:

Firmware V1.3.0 (Multi-Cion) has upgraded the QR code encoding/decoding to a new format. This is an incompatible change and you will need to upgrade your MetaMask Chrome Extension accordingly to the latest version.

2. Bind “MetaMask Extension” with Keystone Hardware Wallet. (Tutorial)

3. MicroSD card (Requirements: Default FAT 32 format and capacity not exceeding 512GB. MicroSD card is not included with Keystone.)

Tip: Keystone can format microSD cards to FAT32. (Tutorial)

4. A microSD card reader (Not necessary if your laptop has an in-built one).

B. Decoding DeFi Transactions

1. Bind “MetaMask Extension” with the Keystone Hardware Wallet. (Tutorial)

2. Insert the microSD card into your computer and download the latest ABI Pack from our GitHub to the microSD card. Unzip the "contracts.zip" file to your microSD card's root directory.

Tips: You can use an open source tool to verify the data in the ABI SQLite.

Click here to download the open source tool from "GitHub > REDEME".

3. Insert the microSD card into the Keystone and turn the device on.

4. Create a DeFi transaction and get the unsigned transaction data in QR code format.

(How to Bind MetaMask with Keystone?)

5. Keystone: Select [Menu] > [Watch-only Wallet] > [MetaMask / DeFi / Web3] > [Confirm]. Then select the "scan" icon and scan the QR code shown by the "MetaMask Extension".

Tips: Keystone supports the switching of wallet paths (ETH) to Ledger Live and Legacy formats in the MetaMask / DeFi / Web3 mode. Please check here for tutorial and more details.

6. Your Keystone will find the relevant ABI and successfully decode your transactions. Keystone will also show the transaction details.

Attention:

1. During the verification process, please keep the microSD card plugged inside the Keystone device at all times. Never pull out the microSD card until you have completed all the signing steps.

2. Even if Keystone has previously read the necessary ABI, it will not remember it. You still need to insert the microSD with the relevant ABI list each time you sign a transaction for this function to work.

7. If your Keystone failed to find the relevant ABI, it will show the coded version of the transaction. You can always add the relevant ABI by yourself. Please go to Chapter IV for specific operation details.

IV. Advanced Operation

Keystone supports users who would like to add their own ABIs onto their microSD cards to address their personal needs. The specific operation is as follows:

Note: This is an advanced feature. It’s not recommended for crypto newbies.

1. Each contract has a json file with the contract address as its name.

For each json file, there are the following fields:

{
    "address":"",
    "name":"",
    "metadata":{
        "output":{
            "abi":[]
        }
    }
}

2. Edit a json file according to the above file format:

1) Both the “address” and “abi” are required. The address follows the EIP 55 address checksum format.

2) The “name” field is not required. You can leave this field empty or delete it if the smart contract you are using doesn’t have a name.

Attention :

1. All letters in the "address" must be lowercased.

2. The “abi” field must be edited strictly in accordance with the hierarchical relationship shown below:

"metadata":{
        "output":{
            "abi":[]
        }
    }

The following is an edited example:

{
    "address":"0x28f886Fa1751e623ff4D8422A230d8B49879Bf61",
    "name":"instaDApp",
    "metadata":{
        "output":{
            "abi":[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc20","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"getId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"setId","type":"uint256"}],"name":"LogDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc20","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"getId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"setId","type":"uint256"}],"name":"LogWithdraw","type":"event"},{"inputs":[],"name":"connectorID","outputs":[{"internalType":"uint256","name":"_type","type":"uint256"},{"internalType":"uint256","name":"_id","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"erc20","type":"address"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"internalType":"uint256","name":"getId","type":"uint256"},{"internalType":"uint256","name":"setId","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getEthAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getEventAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getMemoryAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc20","type":"address"},{"internalType":"uint256","name":"tokenAmt","type":"uint256"},{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"getId","type":"uint256"},{"internalType":"uint256","name":"setId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
        }
    }
}

3. After making the required edits, be sure the file name includes the contact address and ends with “.json” (e.g. 0x28f886fa1751e623ff4d8422a230d8b49879bf61.json)

Attention:

1. All letters in the “address.json” must be lowercase.

2. Verify that you’ve changed the files to the .json format after editing them.

Save the .json file to the "contracts > self_define" path of the microSD card.

Recommended Instructions: How to Use Uniswap with Keystone?

Keystone-ABI-3
Keystone-ABI-4
Keystone-ABI-5
Keystone-ABI-6
Keystone-ABI-7
Keystone-ABI-8
Keystone-ABI-1
Keystone-ABI-2