Skip to main content

Secure seed phrase backup using Shamir's Secret Sharing

Project description

SeedGuard

SeedGuard is a secure Python library for splitting and sharing cryptocurrency seed phrases using Shamir's Secret Sharing. It allows you to split your seed phrase into multiple shares, where only a specific threshold of those shares is needed to reconstruct the original phrase.

Features

  • Supports 12 and 24-word BIP39 seed phrases
  • Implements Shamir's Secret Sharing for secure distribution
  • Optional password encryption for additional security
  • Compact encoding format for easy storage and transmission
  • Simple, minimalist API with just two main methods

Installation

pip install seed-guard

Usage

Splitting a Seed Phrase

from seed_guard import SeedGuard

# Initialize SeedGuard
sg = SeedGuard()

# Your seed phrase (12 or 24 BIP39 words)
seed_phrase = [
    "abandon", "ability", "able", "about", "above", "absent",
    "absorb", "abstract", "absurd", "abuse", "access", "accident"
]

# Encode the seed phrase into shares
# - shares_required: How many shares are needed to recover (threshold)
# - shares_total: Total number of shares to generate
# - password: Optional for additional encryption
primary, shares = sg.encode_seed_phrase(
    seed_words=seed_phrase,
    shares_required=3,
    shares_total=5,
    password="optional-password"  # Optional
)

print(f"Primary piece: {primary}")
for i, share in enumerate(shares, 1):
    print(f"Share {i}: {share}")

# Store these shares separately in secure locations
# IMPORTANT: The primary piece must be stored separately from any shares

Recovering a Seed Phrase

from seed_guard import SeedGuard

# Initialize SeedGuard
sg = SeedGuard()

# The primary piece and at least 'shares_required' shares
primary_piece = "2:7fHs4ZpLKvQBD58XmnzhyfKk8Vy9jR2C3W6TgNJtPbrd"  # Example
collected_shares = [
    "2:hQxPvCkJRL54zSDtNnFM27YbgZ3j8VyKWXc9pBG6Ts",  # Example
    "2:ZPqD5F8KzJVX4gYmN6tnjRv2WTh7cCsLxb3SBpHM",    # Example
    "2:gBtDVKLM53zSrJP64NmfGZcXvkYF8h2T7sRHnWqj",    # Example
]

# Must provide at least 'shares_required' shares as defined when encoding
recovered_seed = sg.decode_shares(
    encoded_primary=primary_piece,
    shares=collected_shares,
    password="optional-password"  # Must match if used during encoding
)

print(f"Recovered seed phrase: {recovered_seed}")

Security Recommendations

  1. Primary Piece Security: The primary piece should be stored separately from any of the shares, ideally in a different location.

  2. Share Distribution: Distribute shares to trusted individuals or store in different secure locations.

  3. Password Handling: If using a password, ensure it's strong and don't store it with the shares.

  4. Minimum Shares: The threshold (shares_required) should be set to balance security vs. recoverability. Setting it too low reduces security, while setting it too high might make recovery difficult if shares are lost.

  5. Testing Recovery: Always test the recovery process with your actual shares before relying on them in a real scenario.

Use Cases

  • Personal Backup: Secure your own cryptocurrency seed phrases against loss while protecting against theft.
  • Inheritance Planning: Distribute shares to family members or attorneys to ensure assets can be recovered in case of emergency.
  • Multi-signature Wallets: Implement secure key sharing for multi-signature cryptocurrency wallets.
  • Business Key Management: Implement secure key sharing for business cryptocurrency holdings.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seed_guard-0.1.2.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seed_guard-0.1.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file seed_guard-0.1.2.tar.gz.

File metadata

  • Download URL: seed_guard-0.1.2.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for seed_guard-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9a416f801d1fa5a37b34f5d30695f5178bdbff03e6cc1a3b2405b9dfac1e6be1
MD5 2c326e0241ed2d0e36928b236b1c0292
BLAKE2b-256 5dc391ef5b44c6021d2f518128d9ed262a4c547b17d942fe26621d0172da35fe

See more details on using hashes here.

File details

Details for the file seed_guard-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: seed_guard-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for seed_guard-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0731ad872692ce966f0420ed87b796fe32cdb6290d5265cc85ac5c40163ea766
MD5 fb92fcd4ac4887c46089c78126c7fffb
BLAKE2b-256 8d785d9f19c00b9b1bf103b7dbc9f60f004f1569230c976088b6c80458faab56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page