Decoding 4-byte Function Signature

I. What is the 4-byte Function Signature?

“Function calls” in the Ethereum Virtual Machine are specified by the first four bytes of data sent with a transaction. These 4-byte signatures are defined as the first four bytes of the Keccak hash (SHA3) of the canonical representation of the function signature. Click here for more information.

II. Why did we implement this feature?

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

We have earned recognition from blockchain communities since we support the Decoding of DeFi Transactions as a feature for users. We have also received a lot of feedback from our users who want us to decode more content from the smart contract and convert that data to human-readable language. Hence, we decided to release a new feature to support the decoding of 4-byte Function Signatures. This will help users understand which function is used by this smart contract when signing a transaction if the concerning ABI can not be decoded, making their transactions safer and verifiable.

III. Decoding 4-byte Function Signatures

Firmware versions V6.0.0 (Multi-Coin) or newer support the decoding of 4-byte Function Signature.

1. Preparation

1) Firmware version V6.0.0 (Multi-Coin) or newer installed on Keystone Essential or Pro.

(Please see firmware upgrade for more help.)

2) Your Keystone Hardware Wallet is bound to your MetaMask Extension in a particular web browser. (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).

2. Decoding DeFi Transactions

1) Insert the microSD card into your computer and download method_signatures from our GitHub to the microSD card. Unzip the "selector.zip" file to your microSD card's root directory.

Tips: You can use an open-source tool to verify the data in the Selector. Click here to download the open source tool from "GitHub > REDEME"

2) Insert the microSD card into the Keystone and turn the device on.

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

4) Keystone: Select [Menu] > [Software Wallet] > [MetaMask / DeFi / Web3] > [Confirm]. Then select the "scan" icon on the top right of your screen to scan the QR code shown by your "MetaMask Extension".

5) Keystone hardware wallet will find the relevant 4-byte Function Signature and successfully decode the transaction(Please be advised that this will only happen if the ABI can not be decoded).

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 Selector, it will not remember it. You still need to insert the microSD with the relevant Selector list each time you sign a transaction for this function to work.

Last updated