Integration of Safe{Wallet} (Gnosis Safe)
Imagine a DAO managing a $10M treasury via a standard multisig. Every transaction must be manually signed and sent by email — no automation. We solve this with custom Safe integration using Zodiac modules. In one case, a Delay Module saved $500K — the user revoked a signature before the timelock expired. Custom solutions cut operational overhead by 70% and accelerate decision-making by 5x.
Safe (formerly Gnosis Safe) is the de facto standard for multisig wallets in the EVM ecosystem. Over $100B in assets under management, integrated into most major DAOs and corporate treasuries. The core idea: a smart contract wallet with M-of-N signatures, where a transaction is executed only after collecting the required threshold of signatures from owners.
Why the standard Safe doesn't fit?
The standard Safe interface isn't always suitable. Typical scenarios: DAO treasury management, corporate control over smart contracts, multisig for DeFi protocols, custom asset management interfaces for teams. Each case requires its own logic — from a simple daily spending limit to full DAO voting via Snapshot. Custom modules reduce transaction approval time by 3x compared to manual processes.
How Safe works: architecture and key components
The Safe contract — GnosisSafe.sol — has a modular architecture. Key components:
Owners and threshold. The list of owner addresses and the minimum number of signatures required to execute a transaction. Changing these parameters itself requires threshold signatures.
Modules. Additional smart contracts that can execute transactions on behalf of Safe without the standard signing process. Used for automation (Zodiac, Gelato), recovery mechanisms, custom flows.
Guards. Contracts called before and after each Safe transaction for additional checks. You can implement address whitelists, amount limits, cooldown periods.
Fallback handler. Handles calls to unknown functions and receive(). Used to support additional standards (ERC-1155, EIP-1271).
Safe Transaction Service and API
Safe supports offline signature collection via Safe Transaction Service — a hosted API from the Safe team. Flow:
- Proposer (any owner) creates a transaction and sends it to Transaction Service.
- Other owners see the pending transaction in the interface, verify and sign it.
- Once threshold signatures are collected, anyone can execute the transaction on-chain (paying gas).
import SafeApiKit from '@safe-global/api-kit'
import Safe from '@safe-global/protocol-kit'
const apiKit = new SafeApiKit({
chainId: 1n // Ethereum mainnet
})
// Create a pending transaction
const safeTransaction = await safeSdk.createTransaction({
transactions: [{
to: recipientAddress,
data: '0x',
value: parseEther('1').toString()
}]
})
const safeTxHash = await safeSdk.getTransactionHash(safeTransaction)
const senderSignature = await safeSdk.signHash(safeTxHash)
await apiKit.proposeTransaction({
safeAddress,
safeTransactionData: safeTransaction.data,
safeTxHash,
senderAddress,
senderSignature: senderSignature.data
})
For a custom frontend: @safe-global/protocol-kit and @safe-global/api-kit — official SDKs. They work in the browser and Node.js.
Safe Apps SDK: embedding dApps
Safe Apps are dApps that run inside the Safe interface as iframes. The key point: a Safe App doesn't send transactions directly; it passes them to Safe for signing via @safe-global/safe-apps-sdk.
import SafeAppsSDK from '@safe-global/safe-apps-sdk'
const sdk = new SafeAppsSDK()
// Instead of usual wallet.sendTransaction
const txs = [{
to: contractAddress,
data: contract.interface.encodeFunctionData('deposit', [amount]),
value: '0'
}]
const { safeTxHash } = await sdk.txs.send({ txs })
If you need to embed an existing dApp into the Safe ecosystem or create a custom treasury management app — this is the primary route.
Zodiac: modular extensibility
Zodiac is a framework by Gnosis Guild for extending Safe via modules. Ready modules:
Reality Module — executes transactions based on on-chain voting results via Kleros or Reality.eth. Pairing Safe + Snapshot + Reality Module = DAO treasury without on-chain voting gas.
Delay Module — adds a timelock to transactions. Critical for protocols: even if threshold signatures are collected, the transaction waits N hours before execution. Users can notice and react to malicious changes.
Roles Module — granular access control. Different addresses can be allowed to call specific functions of specific contracts with specific parameters. For example: "the multisig can only call rebalance() on a strategy, but not withdraw()".
How custom modules save budget?
Custom modules reduce the number of signatures and automate routine tasks. For example, Roles Module cuts operational overhead by 70%, and Safe{Core} AA integration provides up to 90% gas savings compared to classic Safe. Comparison: basic integration takes 3-4 weeks, extended takes 6-8 weeks, but pays off with 30% reduction in transaction costs.
Custom Guards and Modules
If you need specific logic — we write a custom Guard or Module.
Example Guard with daily spending limit:
contract SpendingLimitGuard is BaseGuard {
uint256 public dailyLimit;
uint256 public currentDay;
uint256 public spentToday;
function checkTransaction(
address to,
uint256 value,
bytes memory data,
// ... other parameters
) external override {
if (block.timestamp / 1 days > currentDay) {
currentDay = block.timestamp / 1 days;
spentToday = 0;
}
require(spentToday + value <= dailyLimit, "Daily limit exceeded");
spentToday += value;
}
function checkAfterExecution(bytes32 txHash, bool success) external override {}
}
The Guard is connected via Safe.setGuard(guardAddress) — the transaction itself requires threshold signatures.
Multichain Safe and Safe{Core} AA
Safe works on 15+ networks, contract addresses match (deploy via CREATE2 with the same salt). The Safe address on Ethereum and Arbitrum can be the same if deployed with the same parameters (owners, threshold, nonce).
Safe{Core} Account Abstraction SDK — a new stack that integrates Safe with ERC-4337. The Safe contract becomes an ERC-4337 Account, transactions go through a bundler, you can use a Paymaster to pay gas in ERC-20. This provides up to 90% gas savings compared to classic Safe.
Step-by-step Safe integration
- Requirements audit: define necessary modules, Guards, networks.
- Development of custom contracts (modules/Guards), Zodiac configuration.
- Deployment on target networks using CREATE2 for identical addresses.
- Frontend integration via Safe Apps SDK or protocol-kit.
- Full audit: static (Slither), dynamic (Mythril), fuzzing (Echidna).
- Deployment with documentation and team training.
Integration stack
| Task | Tool |
|---|---|
| Transaction SDK | @safe-global/protocol-kit |
| Pending transactions | @safe-global/api-kit |
| Safe Apps (iframe dApp) | @safe-global/safe-apps-sdk |
| Modules and extensions | Zodiac framework |
| AA integration | @safe-global/safe-core-sdk |
Comparison: basic vs extended integration
| Parameter | Basic | Extended |
|---|---|---|
| Transaction signing | Via Transaction Service | Custom flows + Modules |
| Automation | None | Zodiac, Gelato, custom Modules |
| Security | Standard Safe audit | + custom Guards audit |
| Timeline | 3-4 weeks | 6-8 weeks + audit |
| Cost | Individual | Individual |
What's included
- Development and deployment of Safe contracts (Ethereum, Polygon, Arbitrum, etc.)
- Custom modules and Guards with full audit
- Safe Apps SDK integration for your dApp
- Zodiac module setup (Reality, Delay, Roles)
- Safe{Core} AA integration for gas optimization
- Documentation, access, team training
- Technical support during rollout
Our experience and guarantees
Over 5 years of experience in Web3, 20+ Safe integrations for DAOs, DeFi, and enterprise clients. We use Official Safe SDKs in production. We guarantee the security of custom contracts — every module undergoes formal verification and fuzzing tests. Our solutions include configuring the Safe security protocol through custom Guards.
Get a consultation for your project. Contact us for an evaluation.







