Giter VIP home page Giter VIP logo

onchainsurveys's Introduction

Casper Onchain Surveys

Casper Onchain Surveys is a survey platform built on top of the Casper blockchain. This project allows users to create and participate in surveys while ensuring the data is securely stored on the blockchain.

Project Structure

This project is divided into two parts: a client-side React application and a server-side Node.js application.

Getting Started

NOTE: YOU MUST HAVE AN ACTIVE ACCOUNT IN CASPER BLOCK CHAIN TO USE THIS APPLICATION!

To get started, follow these steps:

  1. Clone the repository.
  2. Install dependencies for both the client and the server.
  3. Create environment file for the server.
  4. Launch a MongoDB
  5. Run the client and the server.

Clone the Repository

git clone https://github.com/yunusem/onchainsurveys.git
cd onchainsurveys

Install Dependencies

# Install client dependencies
cd client
npm install

# Install server dependencies
cd ../server
npm install

Create Environment Files

# Create .env file under server directory
cd server
touch .env

Include the following variables in the .env file:

MONGODB_URI=mongodb://localhost:27017/onchainsurveys
JWT_SECRET=your_jwt_secret
PORT=3001
RPC=http://3.136.227.9:7777/rpc

Launch a MongoDB

Local MongoDB

  1. Install MongoDB on your local machine following the official documentation.
  2. Start the MongoDB service.
  3. Update the MONGODB_URI in the server's .env file with your local MongoDB connection string:
MONGODB_URI=mongodb://localhost:27017/onchainsurveys

MongoDB Atlas

  1. Create a free account on MongoDB Atlas.
  2. Set up a new cluster.
  3. Obtain the connection string for your cluster.
  4. Update the MONGODB_URI in the server's .env file with the obtained connection string:
MONGODB_URI=your_mongodb_atlas_connection_string

Run the Client and the Server

Client

cd client
npm start

This will start the client-side React application at http://localhost:3000

Server

cd ../server
npm start

This will start the server-side Node.js application at http://localhost:3001

Testing

Simply run:

npm install --only=dev
npm test

for each module inside both client and server directories.

Admin configuration

You can set fee amount per question storage and the commition rate under cost of the services. Simply update the .admin file under your server root:

FEE=10
CRATE=9

the reading of the values is dynamic you can edit them in runtime.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.