NOTE: this is still a draft, so it's subject to changes. This alert will be removed as soon as final version will be available

πŸ”@hsuite/multisig

🚧 Work in Progress - This application is currently under active development. Features and APIs may change.

πŸ” Multi-Signature Wallet Platform - Enterprise-grade security and transaction management for the Hedera ecosystem.

A comprehensive multi-signature wallet solution designed specifically for the Hedera network, providing secure transaction management, customizable approval workflows, and enterprise-grade controls with maximum security for digital assets. Built with NestJS, MongoDB, and seamless Hedera integration.

πŸ“‘ Table of Contents

πŸ” Overview

The @hsuite/multisig application provides enterprise-grade multi-signature wallet functionality that supports:

  • Multi-Signature Wallets: Create wallets requiring multiple signatures for transactions

  • Flexible Threshold Management: Configure custom signature requirements (M-of-N)

  • Comprehensive Transaction Support: HBAR transfers, token operations, staking, and account updates

  • Queue-based Processing: Asynchronous transaction handling with Bull Queue

  • Real-time Updates: WebSocket integration for live transaction status updates

  • Cross-Chain Support: Extensible architecture for multiple blockchain networks

✨ Features

🏦 Multi-Signature Wallet Management

  • Create multi-signature wallets with custom threshold requirements

  • Add/remove wallet owners with proper validation and authorization

  • Update wallet configurations including keys and thresholds

  • Track wallet history with comprehensive audit trails

πŸ’° Transaction Operations

  • HBAR Transfers: Send and receive HBAR with multi-signature approval

  • Token Operations:

    • Fungible token transfers (HTS tokens)

    • Non-fungible token (NFT) transfers

    • Token association/dissociation

  • Account Management:

    • Account updates (keys, auto-renew, etc.)

    • Staking operations to consensus nodes

  • Transaction Batching: Group multiple operations for efficiency

πŸ”’ Security & Approval Workflows

  • Threshold Signatures: Configurable M-of-N signature requirements

  • Transaction Validation: Comprehensive checks before execution

  • Owner Management: Secure addition/removal of wallet owners

  • Audit Logging: Complete transaction and signature history

  • Queue Safety: Time-limited transaction windows for security

πŸ”„ Real-time Features

  • WebSocket Gateway: Live updates for transaction status changes

  • Event-driven Architecture: Pub/sub system for real-time notifications

  • Background Processing: Asynchronous transaction handling

  • Status Monitoring: Real-time wallet and transaction status tracking

πŸ—οΈ Technical Architecture

Core Components

Data Models

Multisig Wallet Entity

Transaction History Entity

Transaction Event Entity

Infrastructure Stack

  • Framework: NestJS with TypeScript

  • Database: MongoDB with Mongoose ODM

  • Queue System: Bull Queue with Redis

  • WebSockets: Socket.IO for real-time communication

  • Blockchain: Hedera Hashgraph SDK integration

  • Validation: class-validator and custom business rules

  • Background Jobs: Automatic retry and error handling

πŸ”Œ API Endpoints

Wallet Management

Get Wallet Information

Response:

Wallet Creation

Create Wallet Request

Execute Wallet Creation

Transaction Operations

Create Withdrawal Request

Create Update Request

Create Staking Request

Signature Management

Sign Transaction

Get Transaction Status

Token Operations

Associate Token Request

Dissociate Token Request

πŸš€ Installation & Setup

Prerequisites

  • Node.js 18+ and npm/yarn

  • MongoDB 5.0+

  • Redis 6.0+

  • Hedera testnet/mainnet account

Environment Configuration

Create .multisig.env file:

Installation Steps

  1. Install dependencies:

  1. Start required services:

  1. Initialize database (if required):

  1. Start the application:

  1. Verify installation:

πŸ“š Usage Examples

Complete Multi-Signature Workflow

WebSocket Integration for Real-time Updates

Token Operations Example

πŸ—ƒοΈ Database Schema

Collections Structure

multisig_wallets

multisig_histories

multisig_events

πŸ”’ Security Features

Transaction Security

  • Time-limited requests: Transactions expire after 2 minutes to prevent replay attacks

  • Signature validation: All signatures verified against Hedera public keys

  • Threshold enforcement: Transactions only execute when signature threshold is met

  • Owner validation: Only wallet owners can sign transactions

Access Control

  • JWT Authentication: All API endpoints require valid authentication tokens

  • Wallet ownership: Users can only access wallets they own or are members of

  • Role-based permissions: Different access levels for wallet operations

Data Protection

  • Encrypted storage: Sensitive data encrypted at rest

  • Audit logging: Complete audit trail for all operations

  • Input validation: Comprehensive validation of all inputs

  • SQL injection prevention: MongoDB queries properly parameterized

βš™οΈ Queue System

The application uses Bull Queue for reliable background processing:

Queue Types

  • create.request: Wallet creation requests with 2-minute delay

  • create.execute: Wallet creation execution

  • withdraw.request: Withdrawal requests

  • withdraw.execute: Withdrawal execution

  • update.request: Wallet update requests

  • update.execute: Wallet update execution

  • stake.request: Staking requests

  • stake.execute: Staking execution

  • transaction.sign: Transaction signature processing

Queue Configuration

  • Retry Policy: 3 attempts with exponential backoff

  • Timeout: 2-minute timeout for transaction execution

  • Concurrency: Configurable concurrent job processing

  • Error Handling: Comprehensive error logging and recovery

Monitoring Queues

πŸ”§ Development

Project Structure

Running Tests

Development Commands

Adding New Features

  1. Define interfaces in src/interfaces/

  2. Create/update entities in src/entities/

  3. Implement business logic in src/multisig.service.ts

  4. Add API endpoints in src/multisig.controller.ts

  5. Add queue processing in src/multisig.consumer.ts

  6. Update WebSocket events in src/multisig.gateway.ts

  7. Write tests for all new functionality

πŸ§ͺ Testing

Test Categories

Unit Tests

  • Service method testing

  • Controller endpoint testing

  • Model operation testing

  • Utility function testing

Integration Tests

  • Database integration

  • Queue system integration

  • WebSocket communication

  • Hedera SDK integration

E2E Tests

  • Complete wallet creation workflow

  • Multi-signature transaction flow

  • Error handling scenarios

  • Performance testing

Running Specific Tests

🀝 Contributing

We welcome contributions to improve the multisig platform! Please read our Contributing Guide for details on:

  • Code Style: Follow ESLint and Prettier configurations

  • Testing Requirements: Maintain >90% test coverage

  • Documentation: Update documentation for new features

  • PR Process: Use conventional commits and proper PR templates

Development Workflow

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/amazing-feature

  3. Make changes and add tests

  4. Run the test suite: npm run test multisig

  5. Commit changes: git commit -m 'feat: add amazing feature'

  6. Push to branch: git push origin feature/amazing-feature

  7. Open a Pull Request

πŸ“„ License

This package is part of the HSuite ecosystem and is covered by its license terms.


πŸ†˜ Support & Documentation

  • GitHub Issues: Report bugs and request features

  • API Documentation: Swagger UI at /api/docs when running

  • Community: Join our Discord for real-time support

  • Enterprise Support: Contact us for enterprise deployment assistance


Built with ❀️ by the HSuite Team Securing digital assets on Hedera with enterprise-grade multi-signature solutions Copyright © 2025 HSuite. All rights reserved.

Last updated