Skip to content

Build Multi-Signature Wallet for High-Value Assets #374

@yusuftomilola

Description

@yusuftomilola

Description

Create a multi-signature wallet contract specifically designed for managing high-value assets, requiring multiple authorized signatures for critical operations like ownership transfers, asset modifications, and administrative actions.

Requirements

Contract State:

  • Wallet owners (array of authorized addresses)
  • Required signatures threshold
  • Pending transactions (transaction_id → Transaction)
  • Transaction confirmations (transaction_id → confirmer_address → confirmed)
  • Asset assignments (wallet owns which assets)
  • Daily transaction limits
  • Executed transactions history
  • Owner addition/removal proposals
  • Emergency freeze status

Transaction Data Structure:

  • Unique transaction ID
  • Transaction type (Transfer, Update, Admin, Emergency)
  • Target contract address (asset registry, etc.)
  • Function to call
  • Parameters/data
  • Initiator address
  • Creation timestamp
  • Execution deadline
  • Required confirmations
  • Current confirmations count
  • Confirmed by (array of addresses)
  • Execution status (Pending, Executed, Expired, Revoked)
  • Execution timestamp
  • Transaction value (if applicable)

Wallet Owner Profile:

  • Owner address
  • Addition timestamp
  • Added by address
  • Owner type (Primary, Secondary, Emergency)
  • Voting weight (if weighted signatures)
  • Active status
  • Total confirmations provided
  • Last activity timestamp

Ownership Proposal:

  • Proposal ID
  • Proposal type (Add Owner, Remove Owner, Change Threshold)
  • Target address (for add/remove)
  • New threshold value (for threshold change)
  • Proposer address
  • Proposal timestamp
  • Confirmations received
  • Execution status

Core Functions:

  • Initialize wallet with initial owners and threshold
  • Submit transaction proposal
  • Confirm transaction (by wallet owner)
  • Revoke confirmation (by confirmer, before execution)
  • Execute transaction (anyone can trigger after threshold)
  • Cancel transaction (by initiator or all owners)
  • Propose add wallet owner
  • Propose remove wallet owner
  • Propose change signature threshold
  • Confirm ownership proposal
  • Execute ownership proposal
  • Get pending transactions
  • Get transaction details
  • Get wallet owners
  • Get required confirmations
  • Emergency freeze wallet (requires majority)
  • Emergency unfreeze wallet
  • Set daily transaction limit

Access Control:

  • Wallet owners: Can confirm transactions and proposals
  • Transaction initiator: Can submit and cancel own transactions
  • Any address: Can execute transactions meeting threshold
  • Majority owners: Can execute emergency freeze

Events to Emit:

  • TransactionSubmitted (tx_id, initiator, tx_type, timestamp)
  • TransactionConfirmed (tx_id, confirmer, confirmations_count, timestamp)
  • ConfirmationRevoked (tx_id, revoker, timestamp)
  • TransactionExecuted (tx_id, executor, result, timestamp)
  • TransactionCancelled (tx_id, cancelled_by, timestamp)
  • OwnerAdded (new_owner, added_by, timestamp)
  • OwnerRemoved (removed_owner, removed_by, timestamp)
  • ThresholdChanged (old_threshold, new_threshold, timestamp)
  • WalletFrozen (frozen_by, reason, timestamp)
  • WalletUnfrozen (unfrozen_by, timestamp)
  • DailyLimitReached (limit, attempted_amount, timestamp)

Validation Rules:

  • Minimum 2 owners required for wallet
  • Threshold must be between 1 and total owners
  • Threshold must be <= number of owners
  • Cannot remove owner if it brings total below threshold
  • Confirmer must be a wallet owner
  • Cannot confirm same transaction twice
  • Cannot confirm own transaction (optional security measure)
  • Transaction must not be expired
  • Transaction must not be already executed
  • Cannot execute without meeting threshold
  • Cannot add duplicate owner
  • Cannot remove non-existent owner

Business Logic:

  • Track confirmations from unique owners only
  • Execute transaction automatically when threshold is met
  • Expire transactions after deadline
  • Support weighted signatures (some owners have more voting power)
  • Implement time-lock delays for sensitive operations
  • Support transaction batching (multiple operations in one)
  • Implement daily/weekly transaction limits
  • Support emergency recovery mechanism
  • Track execution history for audit
  • Allow configuration of confirmation requirements per transaction type

Transaction Types:

  • Asset Transfer: Transfer asset ownership (highest security)
  • Asset Update: Modify asset metadata (medium security)
  • Administrative: Change wallet settings (high security)
  • Emergency: Emergency operations (special majority)
  • Routine: Low-value operations (lower threshold)

Security Features:

  • Time-locked execution (delay between approval and execution)
  • Daily transaction limits to prevent abuse
  • Emergency freeze mechanism
  • Proposal-based owner management
  • Transaction expiration to prevent stale approvals
  • Revocation of confirmations before execution
  • Audit trail of all operations
  • Optional transaction whitelisting

Multi-Signature Scenarios:

  • 2-of-3: Two signatures required from three owners
  • 3-of-5: Three signatures from five owners
  • Weighted: Different owners have different voting weights
  • Tiered: Different requirements based on transaction type
  • Emergency: Special majority for emergency actions

Technical Specifications

  • Implement secure transaction ID generation (hash-based)
  • Use efficient storage for confirmations (bitmap or mapping)
  • Implement cross-contract calls for transaction execution
  • Use atomic operations for confirmation and execution
  • Optimize gas costs for large owner sets
  • Implement deadline checking mechanism
  • Use events for all state changes
  • Support batch confirmation (confirm multiple at once)

Acceptance Criteria

  • Wallet can be initialized with owners and threshold
  • Transactions require threshold confirmations to execute
  • Owners can confirm and revoke confirmations
  • Executed transactions call target contracts correctly
  • Owner addition/removal requires proposals and confirmations
  • Threshold can be changed through proposal mechanism
  • Emergency freeze stops all transactions
  • Daily limits are enforced correctly
  • Transaction expiration works properly
  • All events are emitted correctly

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions