safe
Installation
SKILL.md
Safe
Safe is the most widely used smart account infrastructure on EVM chains. Over $100B in assets are secured by Safe contracts. It provides programmable multi-signature wallets with modular extensions via modules and guards.
What You Probably Got Wrong
The Safe ecosystem rebranded and restructured its SDK in 2023-2024. Most LLM training data references the old package names and deprecated APIs.
- Gnosis Safe is now just "Safe" -- The project rebranded. Package scope changed from
@gnosis.pm/safe-*and@safe-global/safe-*(old) to@safe-global/protocol-kit,@safe-global/api-kit,@safe-global/relay-kit. If you see@gnosis.pm/imports, you are using deprecated packages. - Safe{Core} SDK has three kits, not one --
protocol-kithandles on-chain Safe interactions (deploy, sign, execute).api-kittalks to the Safe Transaction Service REST API (propose, confirm, list pending).relay-kitsponsors gas via Gelato/relay. They are separate npm packages. EtherAdapteris removed -- The oldEthersAdapter/Web3Adapterpattern is gone. Protocol Kit v4+ takes aprovider(RPC URL or EIP-1193) andsigner(private key or passkey) directly. No adapter classes.- Transaction Service URLs are chain-specific -- Each network has its own Transaction Service. Mainnet is
https://safe-transaction-mainnet.safe.global, not a generic endpoint. Using the wrong URL silently fails. API Kit takes achainIdand resolves the URL automatically since v2. - Safe modules are NOT the same as guards -- Modules can execute transactions on behalf of the Safe without owner signatures (powerful, dangerous). Guards are hooks that run pre/post-execution for validation checks (like a firewall). Confusing them leads to security holes.
- EIP-1271 signature validation requires the Safe, not an EOA -- When a Safe signs a message, you validate against the Safe contract's
isValidSignature(bytes32, bytes), not against individual owner addresses. The hash must be the Safe-specific message hash fromgetMessageHash(). execTransactionis notexec-- The on-chain function isexecTransactionwith a specific parameter order. The SDK abstracts this but if you call the contract directly, getting the signature encoding wrong is the most common revert cause.- Nonces are sequential, not random -- Safe uses a sequential nonce starting at 0. Skipping a nonce blocks all subsequent transactions. Use the Transaction Service to get the next nonce.