This project implements a decentralized system for enterprise data management and sharing, leveraging blockchain technology, peer-to-peer networking, and flexible data storage solutions.
- Blockchain integration with support for EVM-compatible chains
- Peer-to-peer data sharing using the Gun P2P network
- Flexible data storage with support for both RocksDB and LevelDB
- Token management for native and custom tokens
- Payment processing for data transactions
- Compliance management and event logging on the blockchain
- Plugin system for extensibility
- Internal and external APIs for system interaction
- Python 3.7+
- pip (Python package manager)
-
Clone the repository:
git clone https://github.com/your-repo/decentralized-data-system.git cd decentralized-data-system -
Install the required dependencies:
pip install web3 pygundb cryptography aiohttp -
Install either RocksDB or LevelDB:
- For RocksDB:
pip install python-rocksdb - For LevelDB:
pip install plyvel
- For RocksDB:
Create a configuration file config.py with the following content:
from node import NodeConfig
config = NodeConfig(
blockchain_type='evm',
blockchain_url='https://mainnet.infura.io/v3/YOUR-PROJECT-ID',
private_key='your_private_key_here',
native_token_address='0x...',
db_path='./nodedb',
sqlite_db_path='./sqlite.db',
p2p_port=8000,
plugin_dir='./plugins',
node_id='node1',
node_signature='signature_here',
initial_peers=['http://peer1.example.com', 'http://peer2.example.com']
)Replace the placeholder values with your actual configuration.
-
Start the node:
python main.py -
Interact with the node using the internal and external APIs:
- Internal API:
http://localhost:8080 - External API:
http://localhost:8081
- Internal API:
- GET
/balance/{address}: Get the balance of an address - POST
/transfer: Transfer tokens
- POST
/share_data: Share data with other nodes - GET
/verify_data/{data_hash}: Verify shared data - GET
/get_compliance_history: Retrieve compliance event history
To add new features or customize behavior, you can create plugins in the plugins directory. Each plugin should be a Python module with a class that inherits from a base plugin class (to be implemented).
- Ensure that your private keys and sensitive data are stored securely.
- Use HTTPS for all API endpoints in production.
- Regularly update dependencies to patch any security vulnerabilities.
- Implement proper access control and authentication mechanisms for your APIs.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.