The gas costs consist out of four (or five if refund logic is used for relay support) parts:
Base tx gas
Safe tx execution
Optional: Gas costs refund
The base tx gas is a constant 21k gas.
The data gas is very flexible. It can be calculated by evaluating the transaction data. Each non-zero byte costs 16 gas and each zero byte 4 gas. Examples with concrete costs will be provided below. Also there is some additional execution overhead (e.g. routing through the proxy that is part of this).
The signature check takes around 7k gas per signature. This is around 1k for the signature data and 5-6k to check the signature. This only applies to ECDSA based signatures, as the gas costs of contract based signatures depend on the verification logic of the target contract and confirmations done via `approveHash` are cheaper as the refund storage.
Side note: If a large transaction is signed (very large data field of the Safe transaction) the costs might increase as the data needs to be copied to generate the transaction hash (this is normally not noteworthy and can be handled with a small “buffer” in the gas limit).
The gas required for the safe transaction execution depends on the logic of the contract being called. This needs to be estimated beforehand and is not trivial. We will provide reasonable total limits further below. On `mainnet` it is possible to use the `safe-relay` service to estimate the transaction costs.
The gas costs for the relay refund depends on the token used and should be provided by the relay service.
The final recommended gas limit is based on the total of the above plus a buffer. For the buffer we double the total, as some internal calls require a higher intermediate gas limit as not all gas can be forwarded to the next internal call (“all but one 64th” of EIP-150)
Set delegate for Snapshot DAO (https://snapshot.page/#/delegate/)
Total gas with 2 signatures: 77 000
Recommended gas limit with 2 signatures: 154 000
Upgrade from 1.0.0 to 1.1.1 via interface
The upgrade is a multisend that performs two actions
Set new mastercopy
Set fallback handler
Total gas with 2 signatures: 90 000
Recommended gas limit with 2 signatures: 180 000
Total gas with 2 signatures: 88 000
Recommended gas limit with 2 signatures: 196 000
Total gas with 2 signatures: 75 000
Recommended gas limit with 2 signatures: 150 000
This call includes a refund and therefore will use quite some gas less than the gas limit
Total gas with 2 signatures: 66 000
Recommended gas limit with 2 signatures: 132 000
Gnosis Safe Simulations (Base cost)
Simulations done with off chain signatures, except for the executor.
Nº of Owners
approx base gas cost (assuming 22k for ETH transfer)
1 (initial safe tx)