Overview
Theimport command allows you to import an existing blockchain database file into your Ubu-Block instance. This is useful for:
- Migrating blockchain data between systems
- Restoring from backups
- Joining a network by importing a synced database
- Development and testing with pre-populated data
The import command is currently in development. The command exists in the CLI but the full import functionality is not yet implemented.
Syntax
Parameters
Path to the SQLite database file to import. Must be a valid Ubu-Block blockchain database.Example:
./backups/blockchain-2024-03-01.db or /data/imported-chain.dbCurrent Implementation
As of the current version, the import command displays the path being imported:Planned Functionality
The full import feature will include:Database Validation
Database Validation
- Verify the imported database has the correct schema
- Check for required tables (blockchain, results, pubkeys, etc.)
- Validate block integrity and chain continuity
Data Migration
Data Migration
- Copy blocks from the imported database to your local database
- Preserve all cryptographic signatures and hashes
- Maintain block ordering and chain linkage
Conflict Resolution
Conflict Resolution
- Handle cases where local database already has blocks
- Option to merge or replace existing data
- Detect and resolve chain forks
Progress Tracking
Progress Tracking
- Display import progress (blocks imported / total blocks)
- Show validation status for each block
- Estimate time remaining
Alternative: Manual Database Copy
Until the import command is fully implemented, you can manually copy blockchain databases:Use Cases
Joining a Network
Import a synchronized database from a trusted peer:Disaster Recovery
Restore from a backup after system failure:Development
Import test data for development:Related Commands
init
Initialize a new blockchain instead of importing
validate
Validate an imported blockchain
query
Query imported blockchain data
Troubleshooting
Import path not found
Import path not found
Error: File not found or path is inaccessibleSolution: Verify the database file exists and you have read permissions:
Invalid database format
Invalid database format
Error: Database is not a valid SQLite fileSolution: Verify the file is a valid SQLite database:
Schema mismatch
Schema mismatch
Error: Imported database has wrong schema versionSolution: Ensure the database was created by a compatible version of Ubu-Block. Check for migration scripts.
Development Status
Track the implementation of the import command:- Current: Command accepts path parameter and displays message
- Next: Database validation and schema verification
- Future: Full data migration and conflict resolution