Skip to content

It is a Decentralised version control system like git but tamper-proof built on top of ethereum testnet (Sepolia)

License

Notifications You must be signed in to change notification settings

lviffy/Blockchain-Version-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”— Blockchain Version Control (BVC)

A decentralized version control system inspired by Git, but powered by blockchain and IPFS. Features cost-optimized local commits with efficient blockchain checkpoints.

npm version License: MIT

πŸ“¦ NPM Package Users: After installing via npm, BVC works out-of-the-box with Sepolia testnet! Just run bvc config --setup to get started. No local blockchain deployment needed.

✨ Features

  • πŸš€ Decentralized: No central server required
  • ⛓️ Blockchain-powered: Immutable commit history on Ethereum
  • 🌐 IPFS storage: Decentralized file storage
  • πŸ’° Cost Optimized: Local commits (free) + blockchain checkpoints (efficient)
  • πŸ” Cryptographically secure: SHA256 file hashing
  • πŸ’» Git-like CLI: Familiar commands and workflows
  • 🌍 Multi-network: Supports Sepolia testnet, local dev, and mainnet
  • ↩️ Version Revert: Revert to any previous commit state

πŸ“¦ Installation

Global Installation (Recommended)

npm install -g bvc-eth
bvc config --setup  # Quick setup wizard

Local Installation

npm install bvc-eth
npx bvc config --setup  # Quick setup wizard

For Development

git clone https://github.com/Lviffy/BVC.git
cd BVC
npm install
npm link  # or use: node bin/bvc.js

πŸš€ Quick Start

1. Configure BVC

# Global installation
bvc config --setup

# Local installation  
npx bvc config --setup

What you'll need:

  • Ethereum wallet private key (create a new one for testing!)
  • Network choice (Sepolia testnet recommended for beginners)
  • Test ETH from Sepolia Faucet (free!)

2. Create a Repository

bvc init my-project
cd my-project

3. Add Files and Commit

bvc add README.md
bvc commit -m "Initial commit"

4. Push to Blockchain

bvc push

5. Version Control (Optional)

bvc log                          # View commit history
bvc revert <commit-hash>         # Revert to any previous version

πŸ’° Cost Optimization

BVC is designed for cost efficiency:

Local Commits (Free)

bvc add file.js
bvc commit -m "Add feature"  # No gas fees!

Blockchain Checkpoints (Efficient)

bvc checkpoint --message "Batch multiple commits"  # Single transaction

Benefits:

  • βœ… Unlimited local commits (0 gas fees)
  • βœ… Batch commits into single blockchain transaction
  • βœ… 50-90% gas savings vs individual commits
  • βœ… Full Git-like workflow

πŸ“‹ Complete Command Reference

Repository Management

bvc init [name] - Create repository (blockchain required)

bvc init my-project              # Create blockchain repository
bvc init --local-only my-repo    # Create local repository only
bvc init --interactive           # Interactive setup
bvc init --upgrade-blockchain    # Upgrade local repo to blockchain

bvc config - Configuration management

bvc config --setup               # Interactive setup
bvc config --private-key <key>   # Set wallet private key
bvc config --rpc-url <url>       # Set blockchain RPC
bvc config --ipfs-endpoint <url> # Set IPFS endpoint
bvc config --show                # Show current config

bvc clone <repo-id> - Clone repository

bvc clone 12345abc...            # Clone by repository ID

bvc status - Show repository status

bvc status                       # Show staged/untracked files

File Operations

bvc add <files> - Stage files

bvc add file.js                  # Add single file
bvc add .                        # Add all files
bvc add *.js                     # Add with glob patterns

bvc commit -m "message" - Create commit

bvc commit -m "Add feature"       # Local commit (free)
bvc commit --blockchain -m "msg"  # Direct blockchain commit

bvc revert <commit-hash> - Revert to specific commit

bvc revert 436b0deb               # Revert to specific commit
bvc revert abc123 --force         # Force revert (overwrite changes)
bvc revert def456 --no-backup     # Skip backup creation

Synchronization

bvc push - Push commits to blockchain

bvc push                         # Push individual commits

bvc checkpoint - Batch commits efficiently

bvc checkpoint --message "Batch" # Batch multiple commits
bvc checkpoint --dry-run         # Preview cost savings

bvc pull - Pull latest changes

bvc pull                         # Fetch from blockchain/IPFS

bvc log - View commit history

bvc log                          # Show commit history
bvc log --checkpoints            # Show checkpoint history

Advanced Features

bvc list - List repositories

bvc list                         # Show all repositories

πŸ”§ Configuration

BVC requires blockchain and IPFS configuration:

Required Settings

  • Private Key: Your Ethereum wallet private key
  • RPC URL: Blockchain network endpoint (Sepolia/Mainnet)
  • IPFS Endpoint: IPFS node for file storage

Setup Process

bvc config --setup

This will prompt for:

  1. Wallet private key (keep secure!)
  2. Blockchain RPC URL
  3. IPFS endpoint URL

πŸ’‘ Usage Examples

Basic Workflow

# Setup
bvc config --setup

# Create repository
bvc init my-app
cd my-app

# Development (free local commits)
echo "console.log('Hello');" > app.js
bvc add app.js
bvc commit -m "Add basic app"

echo "console.log('Hello World');" > app.js
bvc add app.js
bvc commit -m "Improve greeting"

# Efficient blockchain sync
bvc checkpoint --message "Initial app development"

Cost Comparison

# Traditional approach (expensive)
bvc commit --blockchain -m "commit 1"  # Gas fee #1
bvc commit --blockchain -m "commit 2"  # Gas fee #2
bvc commit --blockchain -m "commit 3"  # Gas fee #3

# BVC approach (efficient)
bvc commit -m "commit 1"               # Free
bvc commit -m "commit 2"               # Free
bvc commit -m "commit 3"               # Free
bvc checkpoint --message "All commits" # Gas fee #1 only

Version Control with Revert

# View commit history
bvc log

# Revert to previous version
bvc revert 436b0deb               # Revert to specific commit
bvc status                        # Check restored files

# Continue development
bvc add . && bvc commit -m "Fix after revert"

πŸ—οΈ Architecture

Repository Structure

my-project/
β”œβ”€β”€ .bvc/
β”‚   β”œβ”€β”€ config.json      # Repository configuration
β”‚   β”œβ”€β”€ commits.json     # Local commit history
β”‚   β”œβ”€β”€ staging.json     # Staged files
β”‚   └── user-config.json # User blockchain config
β”œβ”€β”€ .bvcignore          # Ignore patterns
└── README.md           # Project files

Data Flow

  1. Local Commits: Files hashed and stored locally
  2. IPFS Upload: File contents uploaded to IPFS on checkpoint
  3. Blockchain Anchor: Commit metadata anchored on Ethereum
  4. Merkle Proofs: Cryptographic integrity verification

πŸ”§ Troubleshooting

Common Issues

"Blockchain configuration required"

# Solution: Configure blockchain first
bvc config --setup

"IPFS node not available"

# Install IPFS
# Option 1: Use public gateway
bvc config --ipfs-endpoint https://ipfs.infura.io:5001

# Option 2: Run local IPFS node
ipfs daemon

"Repository does not exist"

  • Ensure repository was created with bvc init
  • Check repository ID with bvc status

Network Requirements

  • Sepolia Testnet: For testing (recommended)
  • Ethereum Mainnet: For production use
  • IPFS: For decentralized file storage

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

MIT License - see LICENSE file for details.

οΏ½ Documentation

πŸš€ Getting Started

πŸ’° Cost Optimization

  • Cost Optimization Guide - Save 50-90% on gas fees
  • Key Features:
    • βœ… Local commits (free)
    • βœ… Blockchain checkpoints (efficient batching)
    • βœ… IPFS integration

πŸ“‹ Commands & Reference

πŸ”§ Setup & Configuration

πŸ”— Links

echo "console.log('Hello BVC!');" > index.js
bvc-eth add index.js
bvc-eth commit -m "Initial commit"

4. Push to Blockchain

bvc-eth push

5. View History

bvc-eth log

6. Collaborate

# Share your repository ID with others
bvc-eth list --mine

# Others can clone your repository
bvc-eth clone <your-repo-id>

# Pull latest changes
bvc-eth pull

πŸ“‹ Commands

Command Description Status
bvc-eth init [name] Create new repository βœ… Working
bvc-eth config Configure wallet/blockchain βœ… Working
bvc-eth add <files> Stage files for commit βœ… Working
bvc-eth commit -m "msg" Create commit with IPFS upload βœ… Working
bvc-eth status Show repository status βœ… Working
bvc-eth log View commit history βœ… Working
bvc-eth push Push commits to blockchain βœ… Working
bvc-eth pull Pull commits from blockchain βœ… Working
bvc-eth clone <id> Clone repository from blockchain βœ… Working
bvc-eth checkpoint Create commit batches βœ… Working
bvc-eth list List all repositories βœ… Working

βš™οΈ Configuration

BVC requires configuration for blockchain and IPFS integration:

bvc config --setup

Required settings:

  • Private Key: Your wallet private key
  • RPC URL: Blockchain RPC endpoint (Sepolia, Mainnet, etc.)
  • IPFS Endpoint: IPFS node URL

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   BVC CLI       │───▢│  Smart Contract  │───▢│   Blockchain    β”‚
β”‚   (Commander)   β”‚    β”‚   (Solidity)     β”‚    β”‚   (Ethereum)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Local Storage  β”‚    β”‚  File Hashing    β”‚    β”‚      IPFS       β”‚
β”‚   (.bvc/)       β”‚    β”‚   (SHA256)       β”‚    β”‚  (Distributed)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ§ͺ Testing

npm test

πŸ“œ License

MIT Β© Lviffy

🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ž Support


⚠️ Note: This is an early-stage project. Use at your own risk and test thoroughly before production use.

About

It is a Decentralised version control system like git but tamper-proof built on top of ethereum testnet (Sepolia)

Resources

License

Stars

Watchers

Forks

Packages

No packages published