eip712_verifier
v1.0.0
Published
A simple utility to calculate EIP-712 message hashes (specifically the Struct Hash) for verifying transactions on Ledger hardware wallets
Downloads
9
Maintainers
Readme
EIP-712 Message Hash Calculator
A simple utility to calculate EIP-712 message hashes (specifically the Struct Hash) for verifying transactions on Ledger hardware wallets (like Nano S or Nano X).
This tool is particularly useful for transactions where the Ledger displays a "Message Hash" during blind signing that needs to be manually verified.
Prerequisites
To run this tool, you need to have the following installed on your system:
- Node.js: (Version 16 or higher recommended)
- npm: (Usually comes bundled with Node.js)
Installation
- Clone or download this repository.
- Navigate to the project directory:
cd eip712_verifier - Install the required dependencies:
npm install
Usage
Run the script using node and provide the EIP-712 JSON object as a single string argument.
Option 1: Basic Command
node index.js '<JSON_STRING>'Option 2: Using npm link
In the project directory, run:
sudo npm linkNow you can call the tool from anywhere using:
eip712_verifier '<JSON_STRING>'Option 3: Running with npx
You can also run it directly using npx.
npx eip712_verifier '<JSON_STRING>'How it Works
The tool uses the ethers.js library to parse the EIP-712 typed data. It specifically calculates the Struct Hash of the message portion, as this is the hash displayed by Ledger devices during the blind signing process for EIP-712 messages.
Dependencies
- ethers: Used for EIP-712 encoding and hashing.
License
This project is released into the public domain under the Unlicense.
