- Installation
- Configuration
- Network Support
- Working with Wallets
- Transaction Management
- UTXO Management
- Token Management
- Backup and Recovery
- Troubleshooting
The simplest way to get started is using Docker:
- Clone the repository:
git clone https://github.com/yourusername/token-validator.git
cd token-validator
- Create environment file:
cat > .env << EOL
BITCOIN_RPC_USER=your_username
BITCOIN_RPC_PASSWORD=your_password
SECRET_KEY=your-secret-key-here
EOL
- Start services:
docker-compose up -d
- Verify installation:
# Check service status
docker-compose ps
# View logs
docker-compose logs -f
- Pre-configured Bitcoin Core node
- Automatic service orchestration
- Built-in health monitoring
- Data persistence
- Automatic restarts
- Isolated environment
- Python 3.11 or higher
- Bitcoin Core node (optional for mainnet/testnet)
- SQLite3 (included in Python)
- Clone the repository:
git clone https://github.com/yourusername/token-validator.git
cd token-validator
- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Environment Setup:
Edit
.env
file with your settings:
# Bitcoin RPC Configuration
BITCOIN_RPC_USER=your_username
BITCOIN_RPC_PASSWORD=your_password
SECRET_KEY=your-secret-key-here
# Optional overrides
BITCOIN_RPC_HOST=bitcoin
BITCOIN_RPC_PORT=18443
- Service Configuration:
The
docker-compose.yml
file provides:
- Validator service configuration
- Bitcoin Core setup
- Network settings
- Volume management
- Health checks
- Accessing Services:
# Execute validator commands
docker-compose exec validator python -m validator [command]
# Access Bitcoin Core
docker-compose exec bitcoin bitcoin-cli -regtest [command]
Create a .env
file with your network settings:
# Network Selection (mainnet, testnet, regtest)
BITCOIN_NETWORK=testnet
# Bitcoin RPC Configuration
BITCOIN_RPC_HOST=localhost
BITCOIN_RPC_PORT=18332 # Port varies by network
BITCOIN_RPC_USER=your_username
BITCOIN_RPC_PASSWORD=your_password
# Application Settings
APP_SECRET_KEY=your_secret_key
DATABASE_URL=sqlite:///validator.db
- Mainnet: 8332
- Testnet: 18332
- Regtest: 18443
# Update docker-compose.yml bitcoin service
services:
bitcoin:
command:
-server=1
-rpcallowip=0.0.0.0/0
# ... other settings ...
# Start services
docker-compose up -d
# Execute commands
docker-compose exec validator python -m validator wallet create mainnet_wallet --network mainnet
# Update docker-compose.yml bitcoin service
services:
bitcoin:
command:
-testnet=1
-server=1
# ... other settings ...
# Start services
docker-compose up -d
# Execute commands
docker-compose exec validator python -m validator wallet create testnet_wallet --network testnet
# Default configuration works with regtest
docker-compose up -d
# Execute commands
docker-compose exec validator python -m validator wallet create regtest_wallet --network regtest
# Configure for mainnet
export BITCOIN_NETWORK=mainnet
export BITCOIN_RPC_PORT=8332
# Create mainnet wallet
python -m validator wallet create mainnet_wallet --network mainnet
# Generate mainnet address
python -m validator wallet address mainnet_wallet
# Configure for testnet
export BITCOIN_NETWORK=testnet
export BITCOIN_RPC_PORT=18332
# Create testnet wallet
python -m validator wallet create testnet_wallet --network testnet
# Generate testnet address
python -m validator wallet address testnet_wallet
# Configure for regtest
export BITCOIN_NETWORK=regtest
export BITCOIN_RPC_PORT=18443
# Create regtest wallet
python -m validator wallet create regtest_wallet --network regtest
# Generate regtest address
python -m validator wallet address regtest_wallet
- Create Wallet:
docker-compose exec validator python -m validator wallet create <name> [--network <network>] [--type <address_type>]
- List Wallets:
docker-compose exec validator python -m validator wallet list
- Generate Address:
docker-compose exec validator python -m validator wallet generate <name> [--count <number>]
- Get Balance:
docker-compose exec validator python -m validator wallet balance <name>
- View Network Info:
docker-compose exec validator python -m validator wallet network <name>
- Export Wallet:
docker-compose exec validator python -m validator wallet export <name> <path>
- Import Wallet:
docker-compose exec validator python -m validator wallet import <path>
- Create Wallet:
python -m validator wallet create <name> [--network <network>] [--type <address_type>]
- List Wallets:
python -m validator wallet list
- Generate Address:
python -m validator wallet generate <name> [--count <number>]
- Get Balance:
python -m validator wallet balance <name>
- View Network Info:
python -m validator wallet network <name>
- Export Wallet:
python -m validator wallet export <name> <path>
- Import Wallet:
python -m validator wallet import <path>
- Each wallet is network-aware
- Addresses are automatically formatted for the correct network
- Separate storage for each network's wallets
- Network-specific backup files
- Basic Send:
python -m validator wallet send <wallet_name> <recipient_address> <amount>
- Send with Custom Fee Rate:
python -m validator wallet send <wallet_name> <recipient_address> <amount> --fee-rate <sat/vB>
- Send with Memo:
python -m validator wallet send <wallet_name> <recipient_address> <amount> --memo "Payment description"
- Regtest: Default 5 sat/vB
- Testnet/Mainnet: Dynamic fee estimation
- Custom fee rates: 1-100 sat/vB recommended
- Automatic UTXO selection
- Change address generation
- Memo support
- Custom fee rates
- Transaction tracking
- Create and Freeze UTXO:
python -m validator wallet freeze-utxo <wallet_name> <amount> [--memo "Purpose of freeze"]
- View Frozen UTXOs:
python -m validator wallet balance <wallet_name>
# Shows both available and frozen UTXOs
- Create specific value UTXOs
- Freeze UTXOs to prevent spending
- Add memos for tracking
- Automatic UTXO tracking
- Balance segregation (available vs frozen)
-
UTXO Creation:
- Use meaningful memos
- Consider fee implications
- Plan UTXO values carefully
-
UTXO Management:
- Regular balance checks
- Document frozen UTXOs
- Monitor UTXO states
- Create Token:
python -m validator token create <name> <supply> [--decimals <decimals>] [--network <network>]
- List Tokens:
python -m validator token list [--network <network>]
- Transfer Token:
python -m validator token transfer <token_id> <recipient> <amount>
- Get Token Info:
python -m validator token info <token_id>
- Tokens are bound to their creation network
- Cross-network transfers are not supported
- Each network maintains its own token registry
- Create Backup:
python -m validator backup create [--network <network>]
- List Backups:
python -m validator backup list
- Restore from Backup:
python -m validator backup restore <backup_id>
- Separate backup files for each network
- Network information included in backup metadata
- Restore validates network compatibility
- Service Status:
# Check service status
docker-compose ps
# View detailed status
docker-compose ps validator
docker-compose ps bitcoin
- Logs:
# View all logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f validator
docker-compose logs -f bitcoin
- Service Management:
# Restart services
docker-compose restart
# Rebuild services
docker-compose up -d --build
# Reset environment
docker-compose down -v
docker-compose up -d
- Common Docker Issues:
- Port conflicts: Check if ports 5000 or 18443 are in use
- Volume permissions: Ensure proper ownership of mounted volumes
- Network connectivity: Verify services can communicate
- Resource constraints: Monitor container resource usage
- Network Connection:
# Test network connection
python -m validator network test
- Address Validation:
# Validate address format
python -m validator wallet validate <address>
- Network Status:
# Check network status
python -m validator network status
- Mainnet Issues:
- Check Bitcoin Core sync status
- Verify RPC credentials
- Confirm network port (8332)
- Testnet Issues:
- Ensure testnet node is running
- Check testnet port (18332)
- Verify testnet faucet access
- Regtest Issues:
- Confirm regtest mode is active
- Check regtest port (18443)
- Verify block generation