Skip to content

heirlabs/heir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

HEIR.ES - Inheritance Smart Contract Builder

License: MIT

Status: Open-source release v1.0.0 — production deployment at heir.es

This repository is the public MIT snapshot. Internal history and operations remain in the private heirlabs/web monorepo.

A comprehensive, no-code web application for legal, accounting, and estate management professionals to create smart contracts for digital asset inheritance. The platform is currently in active development with working core features and ongoing integration testing.

Features

🎯 Core Functionality

  • No-Code Smart Contract Generation: Create inheritance contracts through an intuitive wizard interface
  • Multi-Blockchain Support: Generate contracts for EVM-compatible chains (Ethereum, Polygon, Base, Avalanche) and Solana
  • EVM Patterns: EVM contracts follow h3irs/protocol patterns with:
    • ERC6551 (Token Bound Accounts) module support
    • setModule/resetModule/claimModule pattern
    • Timer-based dead man's switch per NFT/module
    • Anyone can claim (allows bots to claim on behalf of beneficiaries)
    • Traditional contract-based inheritance for native currency and tokens
  • Solana Patterns: Solana contracts follow heirlabs/estate patterns with:
    • Inactivity period + grace period dead man's switch
    • Check-in system to reset timer
    • Emergency lock/unlock mechanisms
    • Up to 10 beneficiaries with percentage-based distribution
  • Inheritance Law Templates: Pre-built templates for:
    • Common Law (per capita, per stirpes)
    • Civil Law (forced heirship)
    • Islamic Law (Mirth, Wasiyyah, Waqf)
    • Custom logic templates

🔒 Security Features

  • Dead Man's Switch: Timeout-based mechanism to prevent premature asset claims
  • Access Control: Owner-only functions for contract management
  • Reentrancy Protection: Built-in security measures
  • Security Audit: npm audit runs during CI/CD (now enforced, previously ignored)

💼 Professional Tools

  • Beneficiary Management: Easy addition and management of beneficiaries
  • Asset Management: Support for native currencies, tokens (ERC-20/SPL), and NFTs (ERC-721)
  • Gas Estimation: Cost estimates for contract deployment
  • Plain English Summaries: Human-readable contract explanations

Project Structure

├── server/                 # Backend Express server
│   ├── generators/         # Code generators (Solidity, Solana)
│   ├── templates/          # Inheritance law calculators
│   ├── validators/         # Input validation
│   ├── audit/              # Static analysis
│   └── server.js           # Main server file
├── src/
│   ├── components/
│   │   └── wizard/         # Wizard step components
│   ├── pages/
│   │   └── ContractBuilder.jsx
│   └── styles/
└── package.json

Installation

Prerequisites

  • Node.js 18+ and npm
  • For Solana contracts: Rust and Anchor framework (optional, for local compilation)

Setup

  1. Install frontend dependencies:
npm install
  1. Install backend dependencies:
cd server
npm install
  1. Start the backend server:
cd server
npm run dev
# Server runs on http://localhost:3001
  1. Start the frontend development server:
npm run dev
# Frontend runs on http://localhost:5173

Usage

Creating an Inheritance Contract

  1. Navigate to /builder in your browser
  2. Follow the wizard steps:
    • Step 1: Select blockchain (EVM or Solana) and enter owner address
    • Step 2: Add digital assets (native currency, tokens, NFTs)
    • Step 3: Add beneficiaries with their wallet addresses
    • Step 4: Select inheritance law template and configure parameters
    • Step 5: Configure dead man's switch (lockup period)
    • Step 6: Review configuration and generate contract
  3. Review the generated code and security analysis
  4. Download the contract code for deployment

Deployment

EVM Chains

  1. Copy the generated Solidity code
  2. Use Remix IDE, Hardhat, or Truffle to compile and deploy
  3. Ensure you have OpenZeppelin Contracts installed:
npm install @openzeppelin/contracts

Note: The EVM contract generator follows patterns from h3irs/protocol, including:

  • ERC6551 Module Support: Works with ERC721 NFTs and ERC6551 Token Bound Accounts
  • setModule(): Set beneficiary and timer for each NFT/module (owner must approve contract first)
  • resetModule(): Reset timer to prevent inheritance trigger (check-in function)
  • claimModule(): Anyone can call to transfer NFT to beneficiary after timer expires
  • Limitations: Owner can revoke approval or transfer NFT, making contract ineffective for that NFT

Solana

  1. Copy the generated Rust/Anchor code
  2. Set up an Anchor workspace
  3. Replace the declare_id! with your program ID
  4. Build and deploy using Anchor CLI

Note: The Solana contract generator follows patterns from heirlabs/estate, including:

  • Inactivity period (24 hours to 300 years) + grace period (24 hours to 90 days)
  • Check-in system via checkIn() instruction
  • Emergency lock/unlock functionality
  • Up to 10 beneficiaries with shares that must sum to 100%
  • Event emissions for all state changes

API Endpoints

POST /api/generate

Generate smart contract code based on input configuration.

Request Body:

{
  "blockchain": "evm" | "solana",
  "ownerAddress": "0x...",
  "assets": [...],
  "beneficiaries": [...],
  "inheritanceTemplate": {...},
  "deadMansSwitch": {...}
}

Response:

{
  "contractCode": "...",
  "contractInfo": {...},
  "analysis": {...},
  "success": true
}

POST /api/estimate-gas

Estimate gas fees for contract deployment and operations.

Security Considerations

⚠️ Important Security Notes:

  1. Dead Man's Switch: The timeout-based mechanism requires regular activity updates. If you don't update activity, beneficiaries can claim after the lockup period.

  2. Private Keys: Never share your private keys. The contract owner must securely manage their wallet.

  3. Testing: Always test contracts on testnets before deploying to mainnet.

  4. Legal Review: Have a legal professional review the contract logic before deployment.

  5. Oracle-Based Switch: If using oracle-based dead man's switch, ensure the oracle is trustworthy.

Inheritance Law Templates

Common Law

  • Per Capita: Equal distribution to all beneficiaries
  • Per Stirpes: Distribution by family branch

Civil Law

  • Forced Heirship: Reserved portion for reserved heirs (children, spouse)
  • Disposable Portion: Remaining portion can be freely distributed

Islamic Law (Mirth)

  • Fixed shares based on relationships:
    • Spouse: 1/8 (if children exist)
    • Sons: Double share of daughters
    • Daughters: Half share of sons
    • Parents: 1/6 each
    • And more...

Islamic Law (Wasiyyah)

  • Up to 1/3 of estate can be bequeathed to non-heirs or charitable causes

Islamic Law (Waqf)

  • Endowment for charitable or religious purposes in perpetuity

Development

Adding New Templates

  1. Create a calculator function in server/templates/
  2. Add template option in InheritanceTemplate.jsx
  3. Update code generators to use the new template

Extending Code Generators

Modify server/generators/solidity.js or server/generators/solana.js to add new features or optimize generated code.

Related projects

Repo Role
h3irs/protocol EVM inheritance contract patterns
heirlabs/estate Solana estate program patterns
heirlabs/heir-eliza AI agent runtime (not vendored here)
heirlabs/heir-mcp MCP server (included in heir-mcp/)

Contributing

See CONTRIBUTING.md. Report security issues per SECURITY.md.

License

MIT License — see LICENSE and NOTICE.

Disclaimer

This software is provided "as is" without warranty. Users are responsible for:

  • Verifying contract logic with legal professionals
  • Testing contracts thoroughly before mainnet deployment
  • Understanding the implications of smart contract deployment
  • Managing their own private keys and wallet security

Support

For issues, questions, or contributions, please open an issue on the repository.

About

Open-source inheritance smart contract platform (MIT)

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors