Skip to content

A secure CLI tool to generate paper wallets for multiple cryptocurrencies (Bitcoin, Ethereum, Solana, Chainlink)

License

Notifications You must be signed in to change notification settings

yhauxell/bitpaper

Repository files navigation

BitPaper πŸ”

Build and Publish npm version License: MIT

A secure CLI tool to generate paper wallets for multiple cryptocurrencies: Bitcoin, Ethereum, Solana, and Chainlink.

Built with Commander.js - the most popular Node.js CLI framework.

✨ Key Features

  • πŸ” 100% Offline - Generate wallets without internet connection
  • 🎯 Multi-Currency - Bitcoin, Ethereum, Solana, Chainlink support
  • πŸ”Œ Plugin Architecture - Easy to add new blockchains
  • ⚑ Plugin Generator - Scaffold new plugins in 2 minutes with yarn generate:plugin
  • πŸ“± QR Codes - Scannable QR codes for each address
  • πŸ”— Explorer Links - Direct links to blockchain explorers
  • πŸ§ͺ Dry-Run Mode - Test without generating real keys
  • πŸ“ BIP39/BIP44 - Industry-standard HD wallet generation
  • 🎨 Interactive CLI - Beautiful, user-friendly interface
  • πŸ”’ Type-Safe - Full TypeScript support

πŸ“š Quick Links

For Users:

For Developers:

Additional:

πŸ“– What is a Paper Wallet?

A paper wallet is a physical document containing your cryptocurrency addresses and private keys, stored completely offline. Think of it as printing out your bank account information, but with cryptographic keys instead.

Why "Paper"?

The name refers to the storage method, not the addresses themselves:

Digital Keys β†’ Written/Printed on Paper β†’ "Paper Wallet"

Types of Crypto Storage:

Type Storage Example Online?
Hot Wallet Software, Online MetaMask, Coinbase βœ… Yes
Hardware Wallet USB Device Ledger, Trezor ❌ No
Paper Wallet Physical Paper BitPaper output ❌ No

Benefits:

  • βœ… 100% offline - Immune to hacking
  • βœ… No electronics - Can't fail or corrupt
  • βœ… Long-term storage - Works for decades
  • βœ… No batteries - Unlike hardware wallets
  • βœ… Low cost - Just paper and ink

Drawbacks:

  • ⚠️ Physical damage (fire, water, deterioration)
  • ⚠️ Can be lost or stolen (like cash)
  • ⚠️ Not convenient for frequent transactions
  • ⚠️ Must manually type keys when spending

πŸ” How Cryptocurrency Addresses Work

The Key Concept: Math, Not Registration

Important: Cryptocurrency addresses are generated using pure mathematics - they don't need to be "registered" on the blockchain!

Traditional Banking:
Bank assigns you account number β†’ Stored in bank database β†’ Now you can receive money

Cryptocurrency:
You generate address with math β†’ No database entry β†’ Can receive crypto immediately

What BitPaper Does:

1. Generate Random Number (256 bits of entropy)
   ↓
2. Create Mnemonic Seed Phrase (24 words)
   ↓
3. Derive Keys Using Elliptic Curve Cryptography
   ↓
4. Generate Public Key from Private Key (one-way math)
   ↓
5. Hash Public Key to Create Address (more one-way math)

All of this happens locally on your computer. No internet. No blockchain interaction.

When Does the Blockchain Get Involved?

The blockchain only knows about your address when:

βœ… Someone Sends You Funds:

Before first transaction:
- Your address exists: Only in your wallet
- Blockchain record: None (address is "invisible")

After first transaction:
- Transaction broadcast to network
- Blockchain records: "0.001 BTC sent to YOUR_ADDRESS"
- Now your address appears on blockchain with balance

βœ… You Spend Funds:

You sign transaction with private key
β†’ Broadcast to network
β†’ Blockchain verifies signature matches address
β†’ Transaction processed

Are These Real Addresses?

YES! 100% real. Here's why:

  1. Mathematically Valid - Generated using the same cryptographic standards as hardware wallets
  2. Blockchain-Ready - Will be accepted immediately when first used
  3. Industry Standard Libraries - Uses the same code as MetaMask, Ledger, and Trezor
  4. Can Hold Real Value - Send real cryptocurrency to them and it will be there

The Address Space is HUGE

Bitcoin addresses: 2^160 = ~1.4 Γ— 10^48 possible addresses
Ethereum addresses: 2^160 = ~1.4 Γ— 10^48 possible addresses
Solana addresses: 2^256 = ~1.15 Γ— 10^77 possible addresses

For comparison:
- Atoms in human body: ~7 Γ— 10^27
- Stars in observable universe: ~10^24
- Grains of sand on Earth: ~7.5 Γ— 10^18

There are more Bitcoin addresses than atoms in a million human bodies!

Could Someone Else Generate the Same Address?

Technically yes, but practically... NEVER.

Probability of collision: ~1 in 10^48

You're more likely to:
βœ“ Win the lottery 6 times in a row
βœ“ Be struck by lightning 10 times in one day
βœ“ Find a specific atom in the universe

To get 50% chance of ONE collision:
- Need to generate: 2^80 addresses (1.2 septillion)
- At 1 billion/second: Would take 38 BILLION years
- Age of universe: 13.8 billion years

Historical evidence:
- Bitcoin launched: 2009
- Addresses generated: Billions+
- Collisions found: ZERO

The cryptographic security of address generation is rock solid! This is why wallets can generate addresses offline without checking if they "already exist."

⚠️ Critical Security Warnings

READ BEFORE USING:

  1. ⚠️ Run this tool OFFLINE on a secure, air-gapped computer
  2. ⚠️ Never share private keys or seed phrases with anyone
  3. ⚠️ Store paper wallets in a secure physical location (safe, vault)
  4. ⚠️ Make backup copies and store in separate secure locations
  5. ⚠️ Verify addresses before sending any funds
  6. ⚠️ This tool is for educational/personal use only

πŸ“¦ Installation

Option 1: Global Installation (Recommended)

npm install -g bitpaper
# or
yarn global add bitpaper

Then run from anywhere:

bitpaper generate

Option 2: Local Development

Clone the repository and install dependencies:

git clone <repository-url>
cd bitpaper
yarn install
yarn build

Then use via yarn or link locally:

yarn link
bitpaper generate

Or run directly:

node bin/cli.js generate

πŸš€ Usage

Generate a Single Wallet Set

bitpaper generate

This will show an interactive selection menu where you can choose which cryptocurrencies to generate (all are selected by default).

Interactive Example:

? Select cryptocurrencies to generate: (Press <space> to select, <a> to toggle all, <i> to invert selection)
❯◉ β‚Ώ  Bitcoin (BTC)
 β—‰ ♦  Ethereum (ETH)
 β—‰ β—Ž  Solana (SOL)
 β—‰ πŸ”— Chainlink (LINK)

Select Specific Cryptocurrencies (Non-Interactive)

# Generate only Bitcoin and Ethereum
bitpaper generate --currencies bitcoin,ethereum

# Generate only Solana
bitpaper generate --currencies solana

# Mix and match
bitpaper generate --currencies bitcoin,solana,chainlink

Address Format Selection

Choose which address format(s) to display for currencies that support multiple formats (e.g., Bitcoin):

# Show only Legacy (P2PKH) addresses (starts with "1")
bitpaper generate --currencies bitcoin --format legacy

# Show only P2SH-SegWit addresses (starts with "3")
bitpaper generate --currencies bitcoin --format p2sh-segwit

# Show only Native SegWit addresses (starts with "bc1") - Most efficient
bitpaper generate --currencies bitcoin --format native-segwit

# Show all three formats (default)
bitpaper generate --currencies bitcoin --format all

πŸ“‹ Format Support by Currency:

Currency Multiple Formats? Notes
Bitcoin βœ… Yes Legacy, P2SH-SegWit, Native SegWit
Ethereum ❌ No Single format (ERC-20 standard)
Solana ❌ No Single format (Ed25519 keypair)
Chainlink ❌ No Uses Ethereum addresses (ERC-20)

πŸ’‘ The --format option only affects currencies with multiple address formats. Other currencies will show a helpful message if --format is used.

Format Comparison:

Format Prefix Fees Compatibility Use Case
Legacy (P2PKH) 1 Higher Maximum Older wallets/exchanges
P2SH-SegWit 3 Medium Good Backward-compatible SegWit
Native SegWit bc1 Lowest Modern ⭐ Recommended for new users

πŸ’‘ All three formats share the same private key - you can receive Bitcoin at any of them and access the funds with the same private key.

Dry Run (Test Without Generating Real Keys)

bitpaper generate --dry-run

Perfect for:

  • βœ… Testing the CLI before real use
  • βœ… Seeing the output format
  • βœ… Demonstrations and screenshots
  • βœ… CI/CD pipeline testing

⚠️ NO real cryptographic keys are generated in dry-run mode!

Generate Multiple Wallet Sets

bitpaper generate --count 5

Generate 5 wallet sets at once.

Save to File

bitpaper generate --output wallets.txt

Important: After printing/backing up, securely delete the file:

shred -vfz -n 10 wallets.txt  # Linux/Mac

Skip Warnings/Instructions

bitpaper generate --no-warnings --no-instructions

Verify a Mnemonic Phrase

bitpaper verify "word1 word2 word3 ... word24"

Checks if a 24-word mnemonic phrase is valid.

Show Supported Cryptocurrencies

bitpaper info

Combine Options

# Generate 3 sets with only Bitcoin and Ethereum, save to file
bitpaper generate --count 3 --currencies bitcoin,ethereum --output wallets.txt

# Bitcoin with only Native SegWit format
bitpaper generate --currencies bitcoin --format native-segwit

# Dry-run with specific currencies
bitpaper generate --dry-run --currencies solana

# Multiple Bitcoin wallets with legacy format only
bitpaper generate --count 5 --currencies bitcoin --format legacy --output legacy-wallets.txt

# Non-interactive with no warnings and specific format
bitpaper generate --currencies bitcoin --format p2sh-segwit --no-warnings --no-instructions

Show Help

bitpaper --help
bitpaper generate --help

πŸ‘©β€πŸ’» For Developers & Contributors

Want to add support for a new blockchain? BitPaper makes it easy!

Quick Start: Generate a Plugin

# Clone the repo
git clone https://github.com/yhauxell/bitpaper.git
cd bitpaper
yarn install

# Generate a new blockchain plugin
yarn generate:plugin

The interactive generator will create all necessary files and register your plugin automatically!

Available Commands

yarn generate:plugin  # Generate new blockchain plugin
yarn build           # Build the project
yarn dev             # Run in development mode

Documentation for Contributors

Why Contribute?

  • βœ… Easy: Plugin generator handles all boilerplate
  • βœ… Fast: Create plugin scaffold in under 2 minutes
  • βœ… Type-safe: Full TypeScript support with interfaces
  • βœ… Documented: Comprehensive guides and examples
  • βœ… Impactful: Help users secure their crypto assets

See something missing? Open an issue or submit a PR!

πŸ“‹ What Gets Generated

Each wallet set includes:

πŸ”‘ BIP39 Mnemonic (24 words)

  • A master seed phrase that can recover ALL wallets
  • MOST IMPORTANT - Store this securely!
  • Can be used to restore wallets in any compatible wallet software

β‚Ώ Bitcoin (BTC)

  • Multiple Address Formats: Choose the format that works best for your wallet/exchange:
    • Legacy (P2PKH): Starts with "1" - Maximum compatibility, higher fees
    • P2SH-SegWit: Starts with "3" - SegWit with backward compatibility, medium fees
    • Native SegWit (P2WPKH): Starts with "bc1" - ⭐ Recommended, lowest fees (~40% lower)
  • All addresses are derived from the same private key
  • Explorer Link: Direct link to Blockchair (check balance/transactions)
  • QR Code: Scannable QR code for easy address sharing
  • Private Key: For sending Bitcoin or importing to wallets
  • WIF (Wallet Import Format): Alternative private key format
  • Public Key: For verification
  • Derivation Path: m/44'/0'/0'/0/0

♦ Ethereum (ETH)

  • Address: For receiving Ethereum
  • Explorer Link: Direct link to Etherscan (check balance/transactions)
  • QR Code: Scannable QR code for easy address sharing
  • Private Key: For sending ETH or importing to MetaMask
  • Public Key: For verification
  • Works with all ERC-20 tokens
  • Derivation Path: m/44'/60'/0'/0/0

πŸ”— Chainlink (LINK)

  • Address: For receiving LINK tokens
  • Explorer Link: Direct link to Etherscan (check balance/transactions)
  • QR Code: Scannable QR code for easy address sharing
  • Private Key: For sending LINK or importing to wallets
  • Note: Uses Ethereum addresses (LINK is an ERC-20 token)
  • Derivation Path: m/44'/60'/0'/0/0

β—Ž Solana (SOL)

  • Address: For receiving Solana
  • Explorer Link: Direct link to Solscan (check balance/transactions)
  • QR Code: Scannable QR code for easy address sharing
  • Private Key: For sending SOL or importing to Phantom/Solflare
  • Public Key: For verification

πŸ“– How to Use Generated Wallets

Receiving Funds

  1. Use the Address to receive funds
  2. Share using QR Code - Scan with wallet apps instead of typing manually
  3. Share the address publicly - it's safe
  4. Test with a small amount first

Using QR Codes

Each address includes a scannable QR code that makes receiving funds easier:

Benefits:

  • βœ… No typing errors
  • βœ… Fast and convenient
  • βœ… Works with all major wallet apps
  • βœ… Can be scanned from printed paper wallets

How to use:

  1. Open your wallet app (MetaMask, Phantom, etc.)
  2. Select "Send" or "Transfer"
  3. Click "Scan QR Code"
  4. Point your camera at the QR code on your paper wallet
  5. Confirm the transaction

For printing:

  • QR codes print clearly on paper
  • Use high-quality printer for best results
  • Test scanning before storing away

Sending Funds

You'll need the Private Key:

Bitcoin:

  • Import the WIF or private key into any Bitcoin wallet
  • Recommended: Bitcoin Core, Electrum, or hardware wallets

Ethereum & Chainlink:

  • Import private key into MetaMask, MyEtherWallet, or similar
  • For LINK: Add the token contract to your wallet

Solana:

  • Import private key into Phantom, Solflare, or similar
  • Or use the CLI: solana-keygen recover

Using the Seed Phrase

Instead of individual private keys, you can restore ALL wallets using the 24-word mnemonic:

  • Bitcoin: Use BIP44 path m/44'/0'/0'/0/0
  • Ethereum: Use BIP44 path m/44'/60'/0'/0/0
  • Solana: Use first 32 bytes of seed

πŸ›‘οΈ Security Best Practices

Before Generation

  1. Disconnect from internet - Run on an offline computer
  2. Use a clean system - Preferably a live USB OS like Tails
  3. Verify the code - Review the source before running

During Generation

  1. Write down immediately - Have paper and pen ready
  2. Double-check - Verify you wrote everything correctly
  3. Don't take photos - Never digitally photograph private keys

After Generation

  1. Store securely - Use a fireproof safe or safety deposit box
  2. Make multiple copies - Store in different secure locations
  3. Test with small amounts - Verify everything works before large transfers
  4. Delete digital files - Securely wipe any generated files:
    shred -vfz -n 10 wallets.txt

Long-term Storage

  1. Use archival paper - Won't degrade over time
  2. Consider metal - Engrave keys on steel plates for fire/water resistance
  3. Protect from elements - Keep dry and away from heat/light
  4. Plan inheritance - Consider how heirs will access (secure instructions)

⚠️ Common Mistakes to Avoid

  1. ❌ Don't generate wallets on an online computer
  2. ❌ Don't store private keys in cloud storage
  3. ❌ Don't take screenshots or photos
  4. ❌ Don't email private keys to yourself
  5. ❌ Don't use the same wallet for multiple purposes
  6. ❌ Don't forget to make backup copies
  7. ❌ Don't throw away the paper - it's your only access!

πŸ§ͺ Testing

Always test with small amounts first:

  1. Generate a wallet
  2. Send a small test amount to the address
  3. Verify you can see the balance
  4. Try sending the test amount back
  5. Only then use for larger amounts

πŸ”§ Technical Details

Standards Used

  • BIP39: Mnemonic phrase generation (24 words, 256-bit entropy)
  • BIP32: Hierarchical deterministic wallets
  • BIP44: Multi-account hierarchy for deterministic wallets
    • Bitcoin: m/44'/0'/0'/0/0
    • Ethereum: m/44'/60'/0'/0/0
  • Bitcoin Address Formats:
    • P2PKH: Legacy format (starts with "1")
    • P2SH: Pay-to-Script-Hash, used for SegWit compatibility (starts with "3")
    • P2WPKH: Native SegWit addresses (starts with "bc1", lowest fees)

Dependencies

Entropy Source

  • Uses Node.js crypto.randomBytes() for secure random number generation
  • Requires system entropy for cryptographically secure keys

Supported Networks

  • Bitcoin: Mainnet (change BITCOIN_NETWORK in code for testnet)
  • Ethereum: All EVM-compatible networks
  • Solana: Mainnet-beta
  • Chainlink: Ethereum mainnet (ERC-20)

πŸ› οΈ Development

Build

yarn build

Compiles TypeScript to JavaScript in the dist/ directory.

Run in Development Mode

yarn dev generate --count 1
# or use ts-node directly
yarn ts-node src/index.ts generate

Project Structure

bitpaper/
β”œβ”€β”€ bin/
β”‚   └── cli.js           # Executable entry point
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts         # Main CLI logic (Commander.js)
β”‚   β”œβ”€β”€ wallet-generator.ts  # Wallet generation functions
β”‚   └── ui.ts            # UI/display functions
β”œβ”€β”€ dist/                # Compiled JavaScript (generated)
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ LICENSE
β”œβ”€β”€ .npmignore
└── README.md

πŸ“¦ Publishing to npm

πŸ€– Automated Publishing (GitHub Actions)

This project uses GitHub Actions to automatically publish to npm when code is merged to main!

Setup (One-time):

  1. Create npm token at npmjs.com
  2. Add token as NPM_TOKEN secret in GitHub repository settings
  3. See GITHUB_SETUP.md for detailed instructions

To Publish a New Version:

# Bump version
yarn version --patch  # or --minor, --major

# Push to GitHub
git push --follow-tags

# GitHub Actions will automatically publish to npm! πŸš€

πŸ“ Manual Publishing

If you prefer to publish manually:

Prerequisites:

  1. Create an npm account: https://www.npmjs.com/signup
  2. Login to npm:
    npm login
    # or
    yarn login

Pre-publish Checklist

Before publishing, make sure:

  • βœ… All tests pass (if you have tests)
  • βœ… Build succeeds: yarn build
  • βœ… Package contents are correct: yarn pack --dry-run
  • βœ… Version number is updated in package.json
  • βœ… CHANGELOG is updated (if you have one)
  • βœ… README is up to date
  • βœ… Git repository is clean and pushed

Publishing Steps

1. Test the Package Locally

# Build and create a test tarball
yarn pack

# Test installation from the tarball
npm install -g ./yausell-bitpaper-v1.0.0.tgz

# Test the CLI
bitpaper --help

# Uninstall test
npm uninstall -g bitpaper

2. Update Version

Follow Semantic Versioning:

# Patch release (1.0.0 -> 1.0.1) - bug fixes
yarn version --patch

# Minor release (1.0.0 -> 1.1.0) - new features
yarn version --minor

# Major release (1.0.0 -> 2.0.0) - breaking changes
yarn version --major

3. Publish to npm

For Public Scoped Package:

npm publish --access public
# or
yarn publish --access public

For Unscoped Package (if you remove @yausell/ from the name):

npm publish
# or
yarn publish

4. Verify Publication

# Check on npm
npm view bitpaper

# Install and test
npm install -g bitpaper
bitpaper --help

Updating the Package

When you make changes:

  1. Make your code changes
  2. Update version: yarn version --patch (or --minor/--major)
  3. Build: yarn build
  4. Publish: yarn publish --access public

Publishing Tips

  • Use npm tags for pre-releases:

    npm publish --tag beta --access public
  • Unpublish within 72 hours if you make a mistake:

    npm unpublish bitpaper@1.0.0
  • Deprecate old versions instead of unpublishing:

    npm deprecate bitpaper@1.0.0 "Please upgrade to 1.0.1"

πŸ”Œ Extending BitPaper with New Blockchains

BitPaper uses a plugin-based architecture that makes it easy to add support for new blockchains without modifying core files.

Plugin Architecture Features

  • βœ… Self-contained: Each blockchain in its own plugin directory
  • βœ… Type-safe: Full TypeScript support with strict interfaces
  • βœ… Auto-discovered: Plugins are automatically registered
  • βœ… Extensible: Support for lifecycle hooks and custom features
  • βœ… No core changes: Add blockchains without touching existing code

Adding a New Blockchain

Using the Plugin Generator (Recommended):

yarn generate:plugin

This interactive command will:

  • βœ… Prompt for blockchain details (name, symbol, icon, explorer URL, etc.)
  • βœ… Generate all necessary files with your configuration
  • βœ… Auto-register the plugin in src/plugins/index.ts
  • βœ… Provide implementation guidance and next steps

Manual Setup:

  1. Copy the plugin template:

    cp -r src/plugins/_template src/plugins/cardano
  2. Implement the BlockchainProvider interface:

    • generateWallet(seed) - Create wallet from BIP39 seed
    • getExplorerUrl(address) - Return block explorer URL
    • formatWalletInfo(wallet) - Format wallet display
    • validateAddress(address) - Validate address format
  3. Register your plugin in src/plugins/index.ts

  4. Build and test:

    yarn build
    bitpaper generate --currencies cardano

πŸ“– Comprehensive Plugin Documentation

Quick Start:

  • Plugin Generator Guide - Interactive plugin scaffolding tool
    • Command reference and usage
    • Prompt explanations
    • Troubleshooting tips
    • Template customization

Complete Development Guide:

  • Plugin Development Guide - Full implementation guide
    • Complete API documentation
    • Step-by-step tutorial with examples
    • Best practices and security guidelines
    • Testing strategies and workflows
    • Advanced features (lifecycle hooks, testnet support)

Technical Documentation:

  • Plugin Architecture - System design documentation
    • Architecture overview and design patterns
    • Core interfaces and components
    • Plugin generator implementation
    • Migration summary and benefits

Contributing:

  • Contributing Guide - Contribution workflow
    • Development setup
    • Code style and conventions
    • Pull request process
    • Security guidelines

Current Built-in Plugins

  • Bitcoin (src/plugins/bitcoin/) - Multi-format support (Legacy P2PKH, P2SH-SegWit, Native SegWit)
  • Ethereum (src/plugins/ethereum/) - ERC-20 compatible
  • Solana (src/plugins/solana/) - Ed25519 keypairs
  • Chainlink (src/plugins/chainlink/) - ERC-20 token

Contributing a Plugin

We welcome blockchain integrations! Please ensure:

  • βœ… Follows plugin template structure
  • βœ… Includes proper error handling
  • βœ… Uses well-maintained dependencies
  • βœ… Tested thoroughly with dry-run and real generation
  • βœ… Documentation for unique features

Submit a PR to add your blockchain to BitPaper! πŸš€

πŸ“š Additional Resources

BitPaper Documentation

Cryptocurrency Standards

Blockchain Documentation

Tools & Libraries

πŸ†˜ Support & Issues

This tool is provided as-is for educational purposes. Always:

  • Test thoroughly before using with real funds
  • Understand the risks of self-custody
  • Consider hardware wallets for large amounts
  • Consult with security professionals for high-value storage

πŸ“„ License

MIT License - Use at your own risk.


Remember: With great power comes great responsibility. You are your own bank! 🏦

About

A secure CLI tool to generate paper wallets for multiple cryptocurrencies (Bitcoin, Ethereum, Solana, Chainlink)

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published