Safe{Wallet} Smart Accounts
This module integrates Safe Smart Accounts into Drupal, allowing users to deploy and manage multi-signature Ethereum wallets directly from their Drupal profiles. It supports creating, signing, and executing transactions, managing signers, and configuring wallet settings, all within Drupal's interface.
Features
Safe Smart Accounts integrates Safe Smart Accounts (formerly Gnosis Safe) into Drupal, enabling users to deploy and manage multi-signature Ethereum wallets directly from their Drupal user profiles.
Basic Functionality
- Deploy Safe Smart Accounts: Users can deploy their own Safe accounts to Sepolia testnet (or mainnet) with custom signer configurations and threshold requirements
- Multi-Signature Management: Create transactions that require multiple signatures before execution, ideal for shared treasuries and collaborative fund management
- Transaction Workflow: Full transaction lifecycle from creation through signature collection to on-chain execution, all within Drupal's UI
- Signer Management: Add or remove signers and adjust signature thresholds through on-chain configuration changes
- Role-Based Access: Supports both Safe owners (creators) and signers (collaborators) with appropriate permissions
Unique Features
- Entity-First Architecture: Safe accounts, transactions, and configurations are Drupal entities with full CRUD workflows, caching, and access control
- Deterministic Deployment: Uses CREATE2 for predictable Safe addresses before deployment
- MetaMask Integration: Seamless wallet integration for deployment, signing, and execution without custom backend infrastructure
- SIWE Authentication: Integrates with the SIWE Login module for Ethereum wallet-based authentication
- Automatic State Sync: Database automatically updates to reflect on-chain state changes after transaction execution
Use Cases
- DAO Treasuries: Enable Drupal-based DAOs and communities to manage shared funds with multi-signature security
- Group Financial Management: Organizations using Drupal can deploy Safe accounts for collaborative fund management
- Web3 Community Platforms: Social platforms built with Open Social or similar distributions can offer treasury features to groups
- Crypto-Native Organizations: Companies operating on-chain can use Drupal as their organizational interface while maintaining custody through Safe accounts
Post-Installation
Initial Setup
- Enable the Module:
drush en safe_smart_accounts -y - Configure Network Settings: Visit
/admin/config/safe-smart-accounts/settingsto configure:- Ethereum network (Sepolia testnet or Ethereum mainnet)
- RPC endpoint URL (Alchemy, Infura, or custom)
- Safe contract addresses (pre-filled for standard deployments)
- Ensure SIWE Login is Enabled: Users must authenticate with Ethereum wallets via the SIWE Login module
User Workflow
Once installed, SIWE-authenticated users can:
- Navigate to their profile tab: "Manage Safes"
- Click "Create Safe Smart Account" to deploy a new Safe
- Configure initial signers (Ethereum addresses) and threshold (e.g., 2 of 3 signatures required)
- Approve deployment transaction in MetaMask
- Wait for blockchain confirmation (~30 seconds on testnet)
- Begin creating and signing transactions from the Safe management interface
Special Considerations
- MetaMask Required: Users need MetaMask or a compatible Web3 wallet browser extension
- Gas Fees: Deploying Safes and executing transactions requires ETH for gas fees
- Testnet First: Start with Sepolia testnet to familiarize users before mainnet deployment
- Cache Management: The module uses Drupal's cache system extensively; always use
drush crafter configuration changes
Additional Requirements
Drupal Modules
- SIWE Login (Required) - Provides Ethereum wallet authentication (EIP-4361: Sign-In with Ethereum)
PHP Requirements
- PHP 8.2+ with GMP extension (required for Ethereum address checksum validation)
- DDEV users: Add
webimage_extra_packages: [php8.3-gmp]to.ddev/config.yaml
JavaScript Libraries
- ethers.js v6 - Loaded via CDN (no local installation required)
- Module includes all necessary JavaScript for Safe deployment, transaction signing, and configuration management
Blockchain Infrastructure
- Ethereum RPC Endpoint - Alchemy, Infura, or self-hosted node
- Safe Contracts - Pre-deployed on Sepolia and mainnet (addresses configured in module settings)
Recommended modules/libraries
- Open Social - This module integrates seamlessly with Open Social distributions for group treasury functionality
- Group - For organizing users and associating Safe accounts with Drupal groups
- Group Treasury - A companion module that extends Safe Smart Accounts to provide group-based treasury management for Drupal groups
Similar projects
To our knowledge, there are no other Drupal modules providing Safe Smart Account integration. Related projects include:
- Ethereum - Provides lower-level Ethereum blockchain integration but does not include Safe-specific functionality or multi-signature wallet management
- Web3 - General Web3 connectivity utilities, but lacks the entity-first Safe account management approach
- SIWE Login - Required dependency; handles wallet authentication but not treasury management
What differentiates Safe Smart Accounts:
- Complete entity-based architecture with Drupal-native CRUD workflows
- Full Safe Smart Account lifecycle management (deployment, configuration, transactions)
- Multi-signature transaction signing and execution workflows
- Automatic synchronization between blockchain state and Drupal database
- Production-ready MetaMask integration with proper signature handling (eth_sign flow with v=31/32)
Supporting this Module
This module was developed as part of ongoing research into decentralized governance and Web3 community tools. If you find it useful, consider:
- Contributing bug reports and feature requests on the issue queue
- Submitting patches and improvements via merge requests
- Sharing your use cases and deployment stories with the community
- Sponsoring development through GitHub Sponsors (link coming soon)
Community Documentation
- GitHub Repository: https://github.com/proofoftom/drupal_safe_smart_accounts - Includes comprehensive CLAUDE.md documentation and service interface specs
- User Guide: See
USERGUIDE.mdin the module directory for step-by-step workflows - Service Interfaces: See
SERVICE_INTERFACES.mdfor developer documentation on the service architecture - Safe Documentation: https://docs.safe.global - Official Safe Smart Account documentation for understanding the underlying protocol
- Demo Site: Coming soon - DrupalPod instance for testing without local setup
Development & Testing
This module includes comprehensive development tooling:
- Hardhat Integration: Smart contract testing environment included in
hardhat.config.ts - TypeScript Tests: Integration tests in
test-safe-contracts.tsusing Mocha and ethers.js v6 - Manual QA Checklists: Validation checklists in
validation/directory for Safe deployment, transactions, and configuration management - PHPStan & PHPCS: Static analysis and coding standards compliance
Architecture Highlights
Safe Smart Accounts follows Drupal best practices with a service-oriented architecture:
- Three Custom Entities: SafeAccount, SafeTransaction, SafeConfiguration
- Service Layer: SafeConfigurationService, SafeTransactionService, SafeBlockchainService, UserSignerResolver
- Cache Invalidation: Automatic cache tag invalidation when Safe state changes, including propagation to all signers
- Access Control: Both route-level and entity-level access checks supporting owners and signers
- Post-Execution Sync: Database automatically updates after on-chain configuration changes
Roadmap
Planned features for future releases:
- Support for additional EVM networks (Polygon, Optimism, Arbitrum, Base)
- Integration with Safe Transaction Service API for off-chain signature collection
- Module support (enable Safe modules like spending limits, recovery mechanisms)
- ENS name resolution for signer addresses
- Transaction templates and common operation shortcuts
- Safe app integration framework for extending functionality