Decoding DeFi Transactions
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.
![Keystone-ABI-3](https://support.keyst.one/~gitbook/image?url=https%3A%2F%2F2420738387-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FrQXQQRT6etffwhkFpfZG%252Fuploads%252Fn5P75mRCc8ha6JIFITIY%252FTF%25E6%258F%2592%25E5%2585%25A5KV.jpg%3Falt%3Dmedia%26token%3Da16ea940-bed4-4cd5-a666-1331a21aff1b&width=768&dpr=4&quality=100&sign=e517d21c&sv=1)
4. Create a DeFi transaction and get the unsigned transaction data in QR code format.
(How to Bind MetaMask with Keystone?)
![Keystone-ABI-4](https://support.keyst.one/~gitbook/image?url=https%3A%2F%2F2420738387-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FrQXQQRT6etffwhkFpfZG%252Fuploads%252FQIwHdghx3ydOWkQ3JWI0%252F1-1%25EF%25BC%2588web3%29-%25E7%25BC%25A9%25E5%25B0%258F35%2525.jpg%3Falt%3Dmedia%26token%3Ddefb56a9-891e-4071-bd18-2ab7c8cbae6e&width=768&dpr=4&quality=100&sign=d9b5df96&sv=1)
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".
![Keystone-ABI-5](https://support.keyst.one/~gitbook/image?url=https%3A%2F%2F2420738387-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FrQXQQRT6etffwhkFpfZG%252Fuploads%252FR9G1gZSPNCElnvJivCNm%252F2-M-5.0.jpg%3Falt%3Dmedia%26token%3D3a77d3ec-17ea-4033-a19c-e782d624d77f&width=768&dpr=4&quality=100&sign=d71e016f&sv=1)
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.
![Keystone-ABI-6](https://support.keyst.one/~gitbook/image?url=https%3A%2F%2F2420738387-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FrQXQQRT6etffwhkFpfZG%252Fuploads%252FcURas1kxZUbpQpi77nEN%252F3-%25E7%25BC%25A9%25E5%25B0%258F70%2525.jpg%3Falt%3Dmedia%26token%3D426b347b-eadd-4728-bd74-623490c06f4f&width=768&dpr=4&quality=100&sign=455c5281&sv=1)
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.
![Keystone-ABI-7](https://support.keyst.one/~gitbook/image?url=https%3A%2F%2F2420738387-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FrQXQQRT6etffwhkFpfZG%252Fuploads%252F0DuzWtsAUhPHtAyy4WMt%252F4-%25E7%25BC%25A9%25E5%25B0%258F70%2525.jpg%3Falt%3Dmedia%26token%3D96cef367-0074-4467-93d4-882c00e36d1d&width=768&dpr=4&quality=100&sign=64d7617e&sv=1)
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:
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:
The following is an edited example:
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.
![Keystone-ABI-8](https://support.keyst.one/~gitbook/image?url=https%3A%2F%2F2420738387-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FrQXQQRT6etffwhkFpfZG%252Fuploads%252FkLBuCgh4IhuXIBiYowFm%252F10-1.png%3Falt%3Dmedia%26token%3De37c3c3b-db50-44f6-b8df-17a302b1e35c&width=768&dpr=4&quality=100&sign=aded55a8&sv=1)
Recommended Instructions: How to Use Uniswap with Keystone?
Last updated