Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Oneironaut Network

An oneironaut is an explorer of dreams. This project is a blockchain-based platform for sharing and connecting dreams.

Features

  • Decentralized Blockchain: A fully functional blockchain implementation.
  • Proof of Connection: A unique consensus mechanism that forges new blocks by finding common themes (tags) in dreams.
  • NLP-powered Dream Analysis: Uses Natural Language Toolkit (NLTK) to extract key tags from dream text.
  • Interactive Dream Map: A web interface that visualizes the connections between dreams as an interactive graph.
  • Cryptographic Security: Transactions are secured with digital signatures, ensuring user ownership and data integrity.
  • Node Network: Supports multiple nodes and can resolve conflicts using the longest-chain rule.
  • Persistent Storage: The blockchain state is saved to an SQLite database, ensuring data survives restarts.
  • Improved Transaction Handling: Transactions are now managed in an in-memory pool before being committed to a block, improving efficiency and and reliability.

Project Structure

The project is structured as a scalable Flask application:

/
|-- app/
|   |-- __init__.py       # Application factory
|   |-- blockchain.py     # Core Blockchain class
|   |-- routes.py         # Flask routes and API endpoints
|   |-- wallet.py         # Wallet for key management and signing
|   |-- db.py             # Database connection and initialization
|   |-- schema.sql        # Database schema definition
|   |-- templates/
|       |-- index.html    # Main web interface
|-- run.py                # Main entry point to run the application
|-- requirements.txt      # Project dependencies
|-- .gitignore            # Git ignore file
|-- .flake8               # Flake8 configuration
|-- pyproject.toml        # Black configuration
|-- blockchain.db         # SQLite database file (created on first run)

Setup and Installation

  1. Create a virtual environment:

    python -m venv venv
  2. Activate the virtual environment:

    • On Windows:
      venv\Scripts\activate
    • On macOS and Linux:
      source venv/bin/activate
  3. Install the required packages:

    pip install -r requirements.txt
  4. Initialize the database and create the genesis block:

    • Important: If you have an old blockchain.db file, please delete it before running this command to ensure the correct schema is applied.
    • On Windows:
      del instance\blockchain.db
    • On macOS and Linux:
      rm instance/blockchain.db
    • Then, run:
      flask --app run init-db
  5. Run the application:

    python run.py

    You can also specify a port:

    python run.py --port 5001

API Endpoints

  • GET /: Renders the main web interface.
  • GET /mine: Mines a new block.
  • POST /transactions/new: Adds a new dream transaction.
  • GET /chain: Returns the full blockchain.
  • POST /nodes/register: Registers new nodes in the network.
  • GET /nodes/resolve: Resolves conflicts between nodes.
  • GET /api/graph_data: Returns the data for the dream map visualization.

Usage

  1. Start the application: Run python run.py.
  2. Open the web interface: Open your browser and go to http://localhost:5000.
  3. Submit dreams: Use the form to submit your dreams.
  4. Mine new blocks: Click the "Mine New Block" button to forge a new block and see the dream map grow.
  5. Explore the dream map: Interact with the graph to see the connections between dreams.

About

An oneironaut is an explorer of dreams. This project is a blockchain-based platform for sharing and connecting dreams.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages