BTC-Mobile is an innovative fork of Bitcoin designed to optimize blockchain technology for mobile devices and international communication. By increasing the block size to 2MB and reducing the block time to 2 minutes, BTC-Mobile enhances transaction throughput and reduces confirmation times, making it ideal for modern mobile-first users. Leveraging advanced AI and ML techniques, decentralized storage solutions like IPFS, and over 88 open-source communication protocols, BTC-Mobile aims to bring Satoshi Nakamoto's vision of decentralized peer-to-peer electronic cash to the next generation of users.
BTC-Mobile is designed to address the evolving needs of the Bitcoin community, focusing on mobile optimization, transaction speed, and enhanced security. This project aims to make Bitcoin more accessible and efficient for mobile devices while ensuring secure and decentralized transactions.
- Increased Block Size and Reduced Block Time: Block size increased to 2MB and block time reduced to 2 minutes, enhancing transaction throughput and reducing confirmation times.
- Simplified Payment Verification (SPV): Lightweight nodes for mobile devices to participate in the network without downloading the entire blockchain.
- IPFS Integration: Decentralized storage for enhanced data availability and reduced reliance on centralized servers.
- AI and ML Integration: Optimizations for various communication protocols, including HTTP/HTTPS, WebSockets, MQTT, CoAP, and many others, ensuring efficient and reliable communication.
- Support for 88+ Communication Protocols: Facilitates seamless international transactions and global interoperability.
- Satellite Communication (SatCom): Ensures users in remote and underserved areas can participate in the Bitcoin network.
-
Clone the Repository:
git clone https://github.com/yourusername/btc-mobile.git cd btc-mobile
-
Install Dependencies:
# Example for Python dependencies pip install -r requirements.txt
-
Set Up the Environment:
cp .env.example .env # Edit .env with your configuration
To start the SPV client:
python spv_client.py
To upload data to IPFS:
python ipfs_upload.py "your data here"
To run the PWA:
# Serve the PWA using a web server
python -m http.server
- Fork Bitcoin Core repository and rename the project to BTC-Mobile.
- Set up the development environment and initialize the Git repository.
- Create initial documentation (README.md, LICENSE, CONTRIBUTING.md).
- Develop SPV client and integrate IPFS.
- Set up PWA framework and design mobile-friendly UI.
- Adjust blockchain parameters to 2MB block size and 2-minute block time.
- Develop and train AI models for transaction analysis and fraud detection.
- Deploy AI models within the app for real-time analysis and personalized recommendations.
- Implement data security measures and integrate open-source communication protocols.
- Integrate satellite communication (SatCom) to extend network reach.
- Conduct unit and integration testing, followed by security audits.
- Perform comprehensive testing and gather user feedback through beta testing.
- Iterate on design and implementation based on feedback.
- Finalize and publish comprehensive documentation.
- Engage with the developer community and prepare for open-source release.
- Prepare for beta launch and conduct beta testing.
- Launch full release and provide ongoing support and updates.
We welcome contributions from the community. Please read our CONTRIBUTING.md for guidelines on how to contribute to this project.
This project is licensed under the MIT License. See the LICENSE file for details.
Sure! Here’s a README that summarizes everything we’ve done to set up the SPV node with Flask, Gunicorn, Nginx, and how to integrate it into your BTC-Mobile project.
This repository sets up a Simplified Payment Verification (SPV) node for interacting with the Bitcoin blockchain via a Flask API. The backend is production-ready using Gunicorn as the WSGI server and Nginx as a reverse proxy. This setup can be used in mobile applications (BTC-Mobile) to interact with the Bitcoin network, query blockchain data, and verify transactions.
- Raspberry Pi 4 (or any similar ARM-based system)
- Raspberry Pi OS (preferably 64-bit)
- Python 3.x installed
- Bitcoin Core (installed in SPV mode)
- Internet Connection for downloading dependencies
First, update your system and install the necessary dependencies:
sudo apt update && sudo apt upgrade -y
sudo apt install wget curl git build-essential python3-pip python3-venv nginx -y
We will create and activate a Python virtual environment to isolate the project dependencies.
python3 -m venv ~/myenv
source ~/myenv/bin/activate
Your prompt should now show (myenv)
.
Install the necessary Python packages for Flask and Bitcoin RPC:
pip install flask bitcoinrpc httpx typing_extensions
Download and install Bitcoin Core, which will run in SPV mode:
wget https://bitcoincore.org/bin/bitcoin-core-28.0/bitcoin-28.0-aarch64-linux-gnu.tar.gz
tar -xvf bitcoin-28.0-aarch64-linux-gnu.tar.gz
sudo mv bitcoin-28.0/bin/* /usr/local/bin/
Create the bitcoin.conf
file to configure Bitcoin Core to run in SPV mode (lightweight):
mkdir ~/.bitcoin
nano ~/.bitcoin/bitcoin.conf
Add the following configuration:
server=1
txindex=0
prune=550
blockfilterindex=1
disablewallet=1
rpcuser=bitcoinrpc
rpcpassword=changeme
rpcallowip=127.0.0.1
rpcport=8332
Run Bitcoin Core in SPV mode with pruning enabled:
bitcoind -daemon -reindex
Create a Flask API (spv_api.py
) to interact with the Bitcoin Core node and serve endpoints to fetch blockchain data and verify transactions.
Create the Python file:
nano spv_api.py
Add the following code to spv_api.py
:
from flask import Flask, jsonify, request
from bitcoinrpc.authproxy import AuthServiceProxy
app = Flask(__name__)
# Replace with your RPC credentials
rpc_user = "bitcoinrpc"
rpc_password = "changeme"
rpc_url = f"http://{rpc_user}:{rpc_password}@127.0.0.1:8332"
rpc_connection = AuthServiceProxy(rpc_url)
@app.route('/headers', methods=['GET'])
def get_headers():
best_block_hash = rpc_connection.getbestblockhash()
headers = rpc_connection.getblockheader(best_block_hash)
return jsonify({"headers": headers})
@app.route('/verify', methods=['POST'])
def verify_transaction():
txid = request.json.get('txid')
proof = rpc_connection.gettxoutproof([txid])
return jsonify({"proof": proof})
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5000)
Gunicorn will serve the Flask app in a production environment.
Install Gunicorn:
pip install gunicorn
Run the Flask app using Gunicorn:
gunicorn --workers 3 spv_api:app
Install Nginx:
sudo apt install nginx
Create a new Nginx configuration for your app:
sudo nano /etc/nginx/sites-available/spv_api
Add the following configuration:
server {
listen 80;
server_name 192.168.2.3; # Replace with your Raspberry Pi's IP or domain name
location / {
proxy_pass http://127.0.0.1:8000; # Gunicorn will run on port 8000
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/spv_api /etc/nginx/sites-enabled
sudo nginx -t
sudo systemctl restart nginx
Create a systemd service for Gunicorn to keep it running in the background:
sudo nano /etc/systemd/system/spv_api.service
Add the following content:
[Unit]
Description=Gunicorn instance to serve spv_api
After=network.target
[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi
ExecStart=/home/pi/myenv/bin/gunicorn --workers 3 --bind 127.0.0.1:8000 spv_api:app
[Install]
WantedBy=multi-user.target
Enable and start the Gunicorn service:
sudo systemctl daemon-reload
sudo systemctl enable spv_api.service
sudo systemctl start spv_api.service
-
Test the API locally using
curl
:curl http://127.0.0.1:5000/headers
-
Test from another device (e.g., laptop, phone) on the same network using the Raspberry Pi's IP:
curl http://192.168.2.3:5000/headers
If you'd like to secure the API with HTTPS, you can use Let’s Encrypt and Certbot for a free SSL certificate:
-
Install Certbot:
sudo apt install certbot python3-certbot-nginx
-
Obtain the SSL certificate:
sudo certbot --nginx
-
Mobile App Integration: Your mobile app can make HTTP requests to the Flask API (running on
http://192.168.2.3:5000
) to query the latest Bitcoin block header, verify transactions, or interact with the Bitcoin network. -
Bitcoin Payment Integration: You can use this setup to monitor incoming Bitcoin payments and verify transactions in real-time on your mobile app. For example, a user can make a Bitcoin payment, and your mobile app can use the
/verify
endpoint to check if the transaction is confirmed. -
Query Blockchain Data: Your mobile app can use the
/headers
endpoint to fetch the latest blockchain data and display it to users, allowing them to monitor the state of the Bitcoin network.
You now have a production-ready environment for interacting with the Bitcoin blockchain using an SPV node, Flask, Gunicorn, and Nginx. This backend is integrated into your BTC-Mobile project, allowing your mobile app to communicate with the Bitcoin network and verify transactions efficiently.