How It Works
Purpose and Origin
Safe Hash Preview was created as a quick response to the WazirX, Radiant and Bybit exploits. The core script was developed by pcaversaccio, and we added a user-friendly interface to make it more accessible.
This tool helps users verify Safe transaction hashes before signing them. It calculates the domain, message, and Safe transaction hashes by retrieving transaction details from either manual input or the Safe transaction service API and computing the hashes using the EIP-712 standard.
How to Use
- Choose the calculation method, defaults to Manual Input. Alternative you can use Safe's API which requires less input.
- Select a network from the dropdown menu.
- Enter the Safe address.
- Fill the rest of the data according to your selected method.
- Click "Calculate Hashes" to view the results.
- Compare the displayed hashes with those shown on your signing device.
How Hashes are Calculated
The hashes are calculated using these steps:
- Collect transaction details either from input or Safe's API.
- Calculate the domain hash using the chain ID and Safe address.
- Calculate the message hash using the transaction details.
- Compute the Safe transaction hash using the domain and message hashes.
The script uses the EIP-712 standard and the same type hashes as the Safe contracts to ensure accuracy.
What to Look For
- Ensure that hashes match the ones displayed on your signing device.
- If you see more than one transaction with the same nonce, ensure it is exclusively because you're trying to replace a transaction. If this is not the case, something unintended is happening.
Tips for Enhanced Security
Run Locally
For maximum security, clone the repository and run this tool locally disconnected from the internet.
Multi-Device Verification
Cross-check results using different devices and browsers to ensure consistency and reduce risk of compromised environments.
Self-Host
For frequent use, consider self-hosting this tool on your own infrastructure to minimize dependencies on third-party services.
Supported Networks
The app supports multiple networks, including Ethereum, Polygon, Arbitrum, and more. For a full list of supported networks, please refer to the network selection dropdown on the main page.