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.0.tar.gz (17.8 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.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: seed_guard-0.1.0.tar.gz
  • Upload date:
  • Size: 17.8 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.0.tar.gz
Algorithm Hash digest
SHA256 c39d8369292f5df05393ef0f968d0557161a1e44a29fb343948d8c7789873a52
MD5 3e439dea4f5b25317e1dc4b721d53889
BLAKE2b-256 32f061a15e56cb142afe5468f950f91d7f0ffa6ae85426cc8353b5aac8adaf1b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: seed_guard-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33d88d67e6abec543735da9ff92b6326d8baa3bdf7ed9fbdc4887c58c3e3d573
MD5 b6cb7369deea28509d9cbe202a3c907c
BLAKE2b-256 617d2917ae2c5932c65875e04cf684c508b6cb2a39121501d26764c614921cfb

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