SansaNet is a decentralized peer-to-peer blockchain project aiming to solve the blockchain trilemma while providing a suite of decentralized services. It features a custom-built blockchain core, P2P networking with reconnection logic, and a proof-of-concept decentralized storage system.
src/core/: Core blockchain logic (Chain, Block, Transaction).src/network/: P2P networking and node management.src/wallet/: Wallet creation and key management.src/web/: Flask-based web interface for interacting with the node.docs/: Documentation and architecture diagrams.
- Python 3.8+
pip install -r requirements.txt
-
Clone the repository.
-
Install dependencies:
pip install -r requirements.txt
To simulate a small network, you can run multiple nodes on different ports.
Node 1 (Genesis Node):
python run_node.py 5000Node 2 (Peer):
python run_node.py 5001 5000This starts Node 2 on port 5001 and connects it to Node 1 on port 5000.
The web interface allows you to view the chain, mine blocks, and upload files.
python src/web/server.pyBy default, this runs on http://localhost:5000 and connects to a backend P2P node on port 6000.
GET /api/chain: View the current blockchain.POST /api/mine: Mine a new block (triggers pending transactions).POST /api/transact: Create a new transaction (requires sender, receiver, amount).GET /api/balance/<address>: Check the balance of an address.POST /api/storage/upload: Upload a file to be chunked and distributed to peers.
- Decentralized Finance (DeFi): Basic coin transfers.
- Decentralized Storage: Shreds files into chunks and distributes them across the network.
- Consensus: Proof of Work (PoW).
We welcome contributions! Please see our contribution guidelines (coming soon).
