Skip to content

WowLabz/dot_marketplace_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dot Marketplace Docker

Setup

First, complete the basic Rust setup instructions. If you want to play at the code level.

If No, then plz follow this simple guide to make your life easy :)

Run in Docker

Install Docker & Docker-Compose

First, install Docker and Docker Compose. Follow the basic installation guide Docker and Docker Compose

For a Windows Machine

Follow the guide mentioned here

Installation from the terminal on a Ubuntu/Linux Machine

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

Docker quick guide

To check the compose version

docker-compose --version

To run the build

docker-compose up --build -d

To stop the service

docker-compose down

To view the installed images locally

docker images

To delete the images

docker rmi <IMAGE ID>

To get more idea about the project and the build please refer the link

Guide To Run All The Services At Once

Once this repo is cloned, follow the commands below to start all the services at once from the main project directory

docker-compose up --build -d

You will be able to see all the running services using

docker ps

To stop all the services

docker-compose down

Guide To Run Each Of The Services Individually

Names of the individual service files

  1. Blockchain Node: tasking_backend.docker-compose.yml
  2. UI: tasking_frontend.docker-compose.yml
  3. Auth Server: authentication_service.docker-compose.yml
  4. Mongodb: marketplace_mongo.docker-compose.yml
  5. IPFS File Server: dot_marketplace_file_server.docker-compose.yml

To run the services individually

docker-compose -f <file_name> up --build -d

To stop an individual service

docker-compose -f <file_name> down

Individual Service Repos (To do a code walkthrough)

  1. Tasking Backend Node
  2. Tasking Frontend
  3. Authentication Service
  4. IPFS File Server

In order to check for the status of the running node run

docker-compose logs <CONTAINER ID>

Run UI

You can access the frontend application on http://127.0.0.1:9001

Screenshot_15

Launch Interactive Bash Session with the Node

docker exec -it <CONTAINER ID> bash

|OR|

docker exec -it <CONTAINER ID> /bin/sh

Run Tests for the blockchain node

Enter into the interactive bash with the container id pertaining to dot_marketplace_node and run the following commands

cargo test (This will run all the test cases)

cargo test <test_name> (For checking any specific test case)

Interacting with Polkadot Js Apps Explorer

BlocksFinality

To check the working of palletTasking go to Developers -> Extrinsics -> Submit the following Extrinsic -> palletTasking -> createTask (Starting Point, explore further we have worked on the full tasking lifecycle)

ChainExtrinsics

Note:

  1. Users will have to install the polkadot-js extension and create an account through the extension. Link to the extension
  2. It's preferred to use the Google Chrome browser.
  3. If the application is started using this docker repo, you will be able to access it at
http://localhost:9001/

Video Demonstrations

  1. Dot Marketplace - Regular Task Workflow
  2. Court Dispute Resolution
  3. Court Sudo Juror
  4. Backend Extrincis: The video demonstrates the flow of tasking backend which was created as a part of Phase 3 but has now been upgraded to milestone based submissions. Video demo in with polkadot.js explorer connected to the node
  5. Backend Decentralized Court workflow testing on Polkadot.js explorer: A functional demo of the court system when a publisher disapproves a milestone Video demo in with polkadot.js explorer connected to the node

Dencetralized Court (Milestone Based)

  1. The court caters to the Web3 space and hence by default becomes an autonomous entity run by the people.
  2. It is designed in a way which resembles an actual offline court that helps in settling long term or short term disputes.
  3. The disputes that we have thought of covering with this court is milestone based.
  4. In the beginning there are 2 entities - a. The Customer b. Worker.
  5. The customer is the entity that puts up work on the platform holding a specific amount for the work done as reward.
  6. The worker is the entity that takes up the work for the customer in a hope to complete it in a given time frame.
  7. When a case is registered for a specific dispute over a task / milestone.
  8. Potential Jurors are selected based on their ratings (which it is set to 4 and above) and matching task tags. Each of them receive notification to accept/decline jury duty. For testing we have set a few accounts with predefined data at genesis here.
  9. The decision to be part of the jury is 1 day (1 era) or 14_400 slots i.e. 24 hours. However, for the purpose of testing it has been set to 5 blocks source code.
  10. Once the day to become a juror has passed. Its not possible to be part of the jury for any respective case. Instead a Sudo juror is selected from a registered pool/council who are part of the chain.
  11. Potential Juror can accept the jury duty and become an active juror by casting the vote and providing the ratings for both customer and worker.
  12. There is limit set on how many jurors can take part. 2 jurors per case based on first come first serve basis.
  13. Once the case begins/accepted, the jurors have 2 eras (2 days) to evaluate the work done & cast their votes to either of the parties i.e. the customer or worker. However, for testing purposes the duration is for 10 blocks.
  14. Once all the votes have been cast by the participating jurors, the winner is decided and the amount is transferred to the winner automatically via the escrow.
  15. If the winner is the customer, the customer doesn't have to pay anything to the worker.
  16. If the winner is the worker, the reward amount from the escrow goes to the worker.
  17. The jurors also get a share (this can be configured) for participating. The court fees is 30% of the total cost, which is divided equally among the final jurors.
  18. If no jurors decide on participating, the process for selection is run for 3 more eras.
  19. Even in those 3 eras there is no juror, then a Sudo juror is selected which is part of the ecosystem and his / her decision is not bound by time.
  20. The Sudo juror is selected using the Fischer-Yates modern method & Linear Congruential Generator.

Functional Guide for Dot Marketplace

  • Customer Workflow:
    1. Create Project
    2. Add Milestones to Project
    3. Add Project to Marketplace
    4. Accept Bid
    5. Approve Milestone
    6. Provide Worker Ratings
    7. Close Milestone
    8. Close Project
    9. Disapprove Milestone
    10. Disapprove Rating
    11. Raise Dispute

  • Worker Work Flow:
    1. Bid For Milestone
    2. Complete Milestone
    3. Provide Customer Ratings
    4. Disapprove Rating
    5. Raise Dispute

  • Juror Work Flow:
    1. Accept Jury Duty

1. User Sign Up

  • Users can choose to sign up either as a Customer or a Worker.
  • User is required to choose from the user tags that are provided, multiple options can be chosen.
  • Customer is the one who wants to post tasks that are to be completed. Worker is the one who bids for tasks and works for its completion.

Screenshot_20211027_122755

2. User Sign In

  • Users can sign in with the username (email) and password.

3. DashBoard

  • Once the user is logged-in, they will see a dashboard and they can connect to the wallet and view all the milestones that have been created by multiple users.

image

  • Connecting the wallet by creating an account (as in the screenshot).

image (1)

  • Once the account is created you can connect the wallet with the application by clicking on Connect Wallet > Polkadot-js. Once clicked you will be able to see the account name and the balance.

  • Account Name is a drop down from which you can choose any of the accounts.

Screenshot_20211027_125821

  • You can now start with workflow for either Customer or Worker by choosing the default accounts Alice or Bob.
  • Otherwise you can connect your own account and request test tokens through Air Drop to perform transactions.

4. Request Air Drop for test tokens

Screenshot_20211027_130413

5. Search Milestones

  • The search functionality is to find projects with one or more milestones, and the worker can use this search bar for accessing all of them based on a specific criteria provided by the worker himself / herself.
Screenshot 1 Screenshot 2
Screenshot Screenshot
Screenshot 3
Screenshot

6. User Dashboard

  • Users can click on the 'User Dashboard' button on the main dashboard to redirect to the User Dashboard that provides the functionality to manage all the projects.
  • Inilitally user will see an empty dashboard and choose to create a new project.

Screenshot_UserDashboard

7. Create Project (by the customer)

  • Mandatory fields:
    • Project Name & Project Tags
    • Add Milestone

Screenshot_CreateProject1

7a. Add Milestone to a project (by the customer)

  • Milestones can be added while creating the project (a minimum of one has to be added while creating the project) and/or before adding the project to the marketplace
  • Mandatory fields:
    • Milestone Name & Milestone Cost
    • Choose the nature of the milestone from the tags
    • Deadline for completion (days)
    • You can choose to upload milestone related files
  • While adding milestone(s) to the project, an amount equivalent to the Milestone Cost is locked into the escrow from the Customer's Account.
Screenshot 1 Screenshot 2
Screenshot Screenshot
Screenshot 3 Screenshot 4
Screenshot Screenshot
  • Final project with one / more milestones

Screenshot_CreateProject3

  • You can click on the project card to see more details.

Screenshot_Project1MoreDetails1

  • You can click on each individual milestone to see full details.

Screenshot_Project1MoreDetails1

8. Add Project To Marketplace (by the customer)

  • If you think the project is ready to be submitted, add the project to the marketplace.

Screenshot_AddProjectToMarketplace

9. Bid for Milestone (by the worker)

  • Inside main dashboard, click on the milestone card and select the milestone for which the worker wants to Bid.
  • While bidding on a milestone, amount equivalent to Milestone Cost is locked into the escrow from Worker's Account.
  • Once the bid is placed successfully, wait for the Customer to accept your bid.
Screenshot 1 Screenshot 2
Screenshot Screenshot

10. Accept Bid (by the customer)

  • Accept a bid most suitable for the milstone.
  • Once the bid has been accepted, you can see the status on the card change from Open to InProgress, as well as the worker's name updated on the card.
  • All the other bids are rejected and the amount locked into the escrow is returned back to their account.
Screenshot 1 Screenshot 2
Screenshot Screenshot

11. Complete Milestone (by the worker)

  • Upload the milestone related file(s) and click on complete milestone.
  • On completion, the status will change from InProgress to PendingApproval.
Screenshot 1 Screenshot 2
Screenshot Screenshot
Screenshot 3 Screenshot 4
Screenshot Screenshot

12. Approve Milestone (by the customer)

  • Provide a suitable rating for the worker according to the work done by the worker.
Screenshot 1 Screenshot 2
Screenshot Screenshot

13. Provide Customer Rating (by the worker)

  • Provide rating for the customer.
Screenshot 1 Screenshot 2
Screenshot Screenshot

14. Close Milestone (by the customer)

  • Once milestone has been closed, the amount is released from the escrow.
  • Customer is debited with the amount for the milestone cost.
  • Worker is credited with the cumulative cost for completion of the milestone + the worker's initial bid amount locked in escrow.
  • The status of milestone after completion is Completed.
Screenshot 1 Screenshot 2
Screenshot Screenshot

15. Close Project

  • A project can be closed if all the milestones for the project are Completed or all the milestones for the project are in state Open.

Screenshot_CloseProject

The decentralized court can be now triggered on every milestone.

16. Disapprove Rating

  • As a Customer, you can disapprove with the kind of work done by the Worker or by rating provided by the Worker.

  • As a Worker, you can disapprove with the rating provided by the Customer.

Screenshot 1 Screenshot 2
Screenshot Screenshot
  • After disapproving, the status of the milestone is changed to Dispute Raised.
Screenshot 1 Screenshot 2
Screenshot Screenshot
  • You can see the details about the dipute by clicking the Show Court button.

Screenshot_CourtDetails

17. Cast Vote

  • As a Juror you cast your vote by providing:
    • Support to either Worker or Customer
    • Rating for Worker
    • Rating for Customer
Screenshot 1 Screenshot 2
Screenshot Screenshot
Screenshot 3
Screenshot
  • As a Sudo Juror you cast your vote if the Juror(s) fail to cast their vote in a particular period of time, or in case of a tie between the votes.
Screenshot 1 Screenshot 2
Screenshot Screenshot
Screenshot 3
Screenshot

16. User Logout

  • Users can logout from the option in the header.

Screenthost_LogOut

To read about the working of the pallet please refer the guide Description

About

Docker setup for all the services of dot_marketplace

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published