Decentralized Horoscopes DApp

Decentralized Horoscopes is a blockchain-powered application that generates and stores horoscopes on-chain. It combines astrology with decentralized technology, ensuring transparency, immutability, and community-driven engagement.

Features

  • On-Chain Horoscope Generation
    Every horoscope is generated and stored on the blockchain, ensuring permanence and transparency.

  • Community Participation
    Users can interact, share, and contribute to community-driven astrological insights.

  • Leaderboard
    Tracks community activity and highlights top contributors.

  • Decentralized Identity
    Users interact with the dApp using their blockchain wallets for authentication.

Components

  • Frontend: Next.js, React, Tailwind CSS
  • Smart Contracts: Solidity (deployed via Remix or Hardhat)
  • Blockchain Interaction: Wagmi
  • Deployment: Vercel for frontend hosting

Contract Features

Core Functions

  • getTodayHoroscope() – Generate/retrieve today’s horoscope for the caller
  • rateHoroscope(uint256 dayId, uint8 rating) – Submit a rating (1–5 stars) for a specific day’s horoscope
  • getMyHistory() – Retrieve caller’s personal horoscope history (dayId, text, rating)
  • getCommunityStats(uint256 dayId) – Get average rating and number of ratings for a given day
  • getHoroscope(address user, uint256 dayId) – View a specific user’s horoscope entry for a day

Events

  • HoroscopeGenerated(address user, uint256 dayId, string text) – Emitted when a new horoscope is generated
  • HoroscopeRated(address user, uint256 dayId, uint8 rating) – Emitted when a horoscope is rated

Randomness

Horoscopes are generated using:

  • block.timestamp – Current block timestamp
  • msg.sender – User’s wallet address
  • blockhash(block.number - 1) – Previous block hash
  • dayId – Derived from block.timestamp / 1 days

This combination ensures each wallet gets a unique, deterministic horoscope per day.

Security Notes

  • Randomness is deterministic and not cryptographically secure
  • Contract is designed for entertainment purposes only
  • Ratings are limited to one per user per horoscope per day
  • Data (horoscopes + ratings) is permanently stored on-chain
  • No admin functions – fully decentralized, no privileged access

Security Notes

  • Contract uses deterministic randomness (not cryptographically secure)
  • Suitable for entertainment purposes only
  • No financial value or critical decisions should depend on results
  • Users can only rate each horoscope once
  • All data is permanently stored on-chain

Getting Started

Prerequisites

  • Node.js (>= 18.x)
  • pnpm or npm
  • MetaMask or any Web3 wallet extension

Installation

  1. Clone the repository
git clone https://github.com/K1297/decentralized-horoscopes-da-pp.git
cd decentralized-horoscopes-da-pp

  1. Install dependencies You can use pnpm, npm, or yarn. Replace with your preferred package manager.
pnpm install
 or
npm install
 or
yarn install

  1. Open your browser and navigate to http://localhost:3000

Contribution Guidelines

We welcome contributions from anyone who would like to help improve our dapp.

To contribute, please follow the following steps:

  • Fork the repository to your own GitHub account: https://github.com/K1297/decentralized-horoscopes.git
  • Create a new branch from the main branch for your changes.
  • Make your changes and commit them with clear commit messages.
  • Push your changes to your forked repository.
  • Open a pull request to merge your changes into the main branch.
Share this project:

Updates