Skip to content

This Bash script calculates the Safe transaction hashes by retrieving transaction details from the Safe transaction service API and computing both the domain and message hashes using the EIP-712 standard.

License

Notifications You must be signed in to change notification settings

josepchetrit12/safe-tx-hashes-util

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Safe Multisig Transaction Hashes

This Bash script calculates the Safe transaction hashes by retrieving transaction details from the Safe transaction service API and computing both the domain and message hashes using the EIP-712 standard.

Supported Networks

  • Arbitrum (identifier: arbitrum, chain ID: 42161)
  • Aurora (identifier: aurora, chain ID: 1313161554)
  • Avalanche (identifier: avalanche, chain ID: 43114)
  • Base (identifier: base, chain ID: 8453)
  • Base Sepolia (identifier: base-sepolia, chain ID: 84532)
  • Blast (identifier: blast, chain ID: 81457)
  • BSC (Binance Smart Chain) (identifier: bsc, chain ID: 56)
  • Celo (identifier: celo, chain ID: 42220)
  • Ethereum (identifier: ethereum, chain ID: 1)
  • Gnosis (identifier: gnosis, chain ID: 100)
  • Gnosis Chiado (identifier: gnosis-chiado, chain ID: 10200)
  • Linea (identifier: linea, chain ID: 59144)
  • Mantle (identifier: mantle, chain ID: 5000)
  • Optimism (identifier: optimism, chain ID: 10)
  • Polygon (identifier: polygon, chain ID: 137)
  • Polygon zkEVM (identifier: polygon-zkevm, chain ID: 1101)
  • Scroll (identifier: scroll, chain ID: 534352)
  • Sepolia (identifier: sepolia, chain ID: 11155111)
  • World Chain (identifier: worldchain, chain ID: 480)
  • X Layer (identifier: xlayer, chain ID: 195)
  • ZKsync Era (identifier: zksync, chain ID: 324)

Usage

Note

Ensure that cast and chisel are installed locally. For installation instructions, refer to this guide.

./safe_hashes.sh [--help] [--list-networks] --network <network> --address <address> --nonce <nonce>

Options:

  • --help: Display this help message.
  • --list-networks: List all supported networks and their chain IDs.
  • --network <network>: Specify the network (e.g., ethereum, polygon).
  • --address <address>: Specify the Safe multisig address.
  • --nonce <nonce>: Specify the transaction nonce.

Before you invoke the script, make it executable:

chmod +x safe_hashes.sh

Example

./safe_hashes.sh --network arbitrum --address 0x111CEEee040739fD91D29C34C33E6B3E112F2177 --nonce 234

The script will output the domain, message, and Safe transaction hashes, allowing you to easily verify them against the values displayed on your Ledger hardware wallet screen:

===================================
= Selected Network Configurations =
===================================

Network: arbitrum
Chain ID: 42161

========================================
= Transaction Data and Computed Hashes =
========================================

> Transaction Data:
Multisig address: 0x111CEEee040739fD91D29C34C33E6B3E112F2177
To: 0x111CEEee040739fD91D29C34C33E6B3E112F2177
Data: 0x0d582f130000000000000000000000000c75fa5a5f1c0997e3eea425cfa13184ed0ec9e50000000000000000000000000000000000000000000000000000000000000003
Encoded message: 0xbb8310d486368db6bd6f849402fdd73ad53d316b5a4b2644ad6efe0f941286d8000000000000000000000000111ceeee040739fd91d29c34c33e6b3e112f21770000000000000000000000000000000000000000000000000000000000000000b34f85cea7c4d9f384d502fc86474cd71ff27a674d785ebd23a4387871b8cbfe00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ea
Method: addOwnerWithThreshold
Parameters: [
  {
    "name": "owner",
    "type": "address",
    "value": "0x0c75Fa5a5F1C0997e3eEA425cFA13184ed0eC9e5"
  },
  {
    "name": "_threshold",
    "type": "uint256",
    "value": "3"
  }
]

> Hashes:
Domain hash: 0x1CF7F9B1EFE3BC47FE02FD27C649FEA19E79D66040683A1C86C7490C80BF7291
Message hash: 0xD9109EA63C50ECD3B80B6B27ED5C5A9FD3D546C2169DFB69BFA7BA24CD14C7A5
Safe transaction hash: 0x0cb7250b8becd7069223c54e2839feaed4cee156363fbfe5dd0a48e75c4e25b3

To see an example of a standard ETH transfer, run the command: ./safe_hashes.sh --network ethereum --address 0x8FA3b4570B4C96f8036C13b64971BA65867eEB48 --nonce 39 and review the output.

To list all supported networks:

./safe_hashes.sh --list-networks

Trust Assumptions

  1. You trust my script 😃.
  2. You trust Linux.
  3. You trust Foundry.
  4. You trust the Safe transaction service API.
  5. You trust Ledger's secure screen.

Community-Maintained User Interface Implementations

Important

Please be aware that user interface implementations may introduce additional trust assumptions, such as relying on npm dependencies that have not undergone thorough review. Always verify and cross-reference with the main script.

About

This Bash script calculates the Safe transaction hashes by retrieving transaction details from the Safe transaction service API and computing both the domain and message hashes using the EIP-712 standard.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 82.2%
  • Shell 15.4%
  • CSS 2.2%
  • JavaScript 0.2%