Challenge2022 - A backend of a Chia project donation platform

Overview

Overview

This is a backend of a Chia project donation platform. People can publish their project on the platform and set a donation goal (e.g. 100 XCH). When a donor donate to this project, the platform will automatically issue some CATs to the donor. The amount of issued CATs is determined by a exchange rate set by the project owner. After the deadline of the project, 95% of the donation XCH will be sent to the project owner wallet and 5% of the donation will be sent to the platform wallet as the fee. In general, it's like a Chia version of KickStarter. Overview

What is New

  • The donor will get some CATs as the proof of a shareholder. These CATs can bu used as the governing token in the future, like DAO.
  • All funds are protected by the Chialisp & Chia Blockchian. No one can touch the fund before the deadline of the donation. If it doesn't meet the goal, the project owner can decide to refund the donation to each donor. The 95%/5% distribution of donation is also fixed in the blockchian since the donor pay the XCH. The project owner will not have concern about the platform holding the fund.
  • Since the platform will issue CAT multiple times, there is an independent signature management service running on the AWS. This service will provide create keys and sign data functions. In the future, the project owner can host their own signature API.
  • Easy to use. With the Gateway coin design pattern, user can use a normal wallet to donate without any extra knowledge. No registeration and membership, which means the project owner can publish the donation address at anywhere they like.

Prerequisites

  • A synced Chia full node (Wallet)
  • Python 3.7.5+
  • AWS DynamoDB and Lambda (They are setup for testing and judge)
  • Some XCH if you want to test the donation function (This will not work for the testnet)

Installation

git clone https://github.com/ytx1991/Challenge2022.git
cd Challenge2022
pip install -r requirements.txt

Note: It requires websockets==10.1.0 which conflict with Chia required version

How to Run

In the project root folder run

nohup python3 server/server.py >/dev/null 2>&1 &

You may need to change python3 to python. It will run the service in the backend. You can check the service.log for debugging.

How to Use

Get Active Projects

Do a GET call to 127.0.0.1:8888/project/active. Here is an example output for one project. For explanation of fields, check server/dao/model/project.py

{
"platform_wallet": "xch1deqxscaype9ww78xc7e77fw6vafvux9nau9lhjhq5qmhyp8t65ysf7valf",
"project_pubkey": "0xaf8dd3e256b1546e15f19734cd31937ba2f43044b337cfcb41dd81699ce59dec77ab8c08c704acd80c8983882a43f0ac",
"project_name": "Integration Test",
"project_desc": "Test project",
"project_wallet": "xch1j9c3xg678flzawmvvkajel32rqrtklp8h82fca336r8j55xxljkq0a2q5j",
"owner_pubkey": "0xafc5afdd4f567c38138430dbd7e2c5f4a079602739e94625e94540f23bf0f91cb003388ece0044f437515dc7fae3f2d1",
"gateway_puzhash": "0x4d5e2407086dd20bb343ec2f390abc15d2bdf75046dd50a8a524d34b069e363b",
"gateway_address": "xch1f40zgpcgdhfqhv6rashnjz4uzhftma6sgmw4p299ynf5kp57xcasx3nnc3",
"asset_id": "0x64ec7bf2869e840bdbc21342ae8e6b59d8cd217741c02d6ae33bf4bbbdc7147f",
"deadline": 1643953931,
"exchange_rate": 10000000,
"goal_amount": 10000000000,
"current_amount": 0,
"status": "IN_PROGRESS",
"logo": "https://chialisp.com/img/logo.svg",
"discord": "https://discord.gg/xVmX362y",
"cat_name": "GardenToken",
"cat_code": "GDN",
"sns": "https://twitter.com/home",
"website": "https://twitter.com/home",
"slug": "test",
"creation_date": 1643935968,
"modified_date": 1643935968
}

Create a Project

Use curl or Postman to POST a request to the 127.0.0.1:8888/project. Here is an example input json. For explanation of fields, check server/dao/model/project.py

    {
    "projectName":"More XCH Please",
    "projectDesc":"Test project",
    "projectWallet": "xch1j9c3xg678flzawmvvkajel32rqrtklp8h82fca336r8j55xxljkq0a2q5j",
    "ownerPubkey": "0xafc5afdd4f567c38138430dbd7e2c5f4a079602739e94625e94540f23bf0f91cb003388ece0044f437515dc7fae3f2d1",
    "deadline": 1643953931,
    "exchangeRate": 10000000,
    "goalAmount": 10000000000,
    "logo": "https://chialisp.com/img/logo.svg",
    "discord": "https://discord.gg/xVmX362y",
    "catName": "GardenToken",
    "catCode": "GDN",
    "sns": "https://twitter.com/home",
    "website": "https://twitter.com/home",
    "slug": "test"
    }

Note:

  • A CAT issuance key will be created automatically in another service, it will never expose in this service.
  • Make sure the deadline timestamp is in the future, otherwise the project will be marked as expired immediately.
  • Make sure the exchangeRate is reasonable. It will determine the minimum donation value, since we cannot issue less than 0.001 CAT

Donate

Just use a Chia wallet to pay some XCH to the gateway_address of the project. We recommend you use wallet which supports CAT. Just wait a couple of minutes, you will see the issued CATs in your wallet.

Mint CAT

CATs will be minted by a long-running listener. It will scan all active projects donation address and spend new coins.

Distribute Fund

After the project past the deadline, the service will flip the project status. In order to optimize the performance, it will read a DynamoDB table to get all donation records instead of get this information from the blockchain. Then it will spend all fund coins, which means the fund will be distributed to the right places with right shares.

Refund Donation

If a project doesn't meet the goal, the owner can decide to take the fund or refund it. The refund operation can only be done by the platform side. The project owner just need to make the decision.

You might also like...
This project is a proof of concept to create a dashboard using Dash to display information about various cryptocurrencies.

This project is a WIP as a way to display useful information about cryptocurrencies. It's currently being actively developed as a proof of concept, and a way to visualize more useful data about various cryptocurrencies.

The (Python-based) mining software required for the Game Boy mining project.

The (Python-based) mining software required for the Game Boy mining project.

A little side-project API for me to learn about Blockchain and Tokens

BlockChain API I built this little side project to learn more about Blockchain and Tokens. It might be maintained and implemented to other projects bu

Deribit_Algo_Project_Python - Deribit algo project written in python trading crypto futures
Deribit_Algo_Project_Python - Deribit algo project written in python trading crypto futures

This is a Algo/script trading for Deribit. You need an account with deribit, to

G-Research-Crypto-Competition - Project for passing the ML exam. Dataset took from the competition on the kaggle

G-Research-Crypto-Competition Project for passing the ML exam. Dataset took from

Python based project to pull useful account statistics from the Algorand block chain.

PlanetWatchStats Python based project to pull useful account statistics from the Algorand block chain. Setup pip install -r requirements.txt Run pytho

Gridlock - Encryption and decryption python project
Gridlock - Encryption and decryption python project

Gridlock Encryption Encryption and decryption of plain text messages inspired by

Owner
Kronus91
Kronus91
Ceres is a combine harvester designed to harvest plots for Chia blockchain and its forks using proof-of-space-and-time(PoST) consensus algorithm.

Ceres Combine-Harvester Ceres is a combine harvester designed to harvest plots for Chia blockchain and its forks using proof-of-space-and-time(PoST) c

null 38 Nov 14, 2022
ETHGreen blockchain is a fork from STAI and Chia blockchain including features implemented by Covid blockchain.

Welcome to ETHGreen Blockchain ETHGreen blockchain is a fork from STAI and Chia blockchain including features implemented by Covid blockchain. About t

null 11 Dec 23, 2022
SHIBgreen is a cryptocurrency forked from Chia and uses the Proof of Space and Time consensus algorithm

SHIBgreen is a cryptocurrency forked from Chia and uses the Proof of Space and Time consensus algorithm

null 13 Jul 13, 2022
A Docker image for plotting and farming the Chia™ cryptocurrency on one computer or across many.

An easy-to-use WebUI for crypto plotting and farming. Offers Plotman, MadMax, Chiadog, Bladebit, Farmr, and Forktools in a Docker container. Supports Chia, Cactus, Chives, Flax, Flora, HDDCoin, Maize, N-Chain, Staicoin, and Stor among others.

Guy Davis 328 Jan 1, 2023
Tink is a multi-language, cross-platform, open source library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse.

Tink A multi-language, cross-platform library that provides cryptographic APIs that are secure, easy to use correctly, and hard(er) to misuse. Ubuntu

Google 12.9k Jan 5, 2023
Cyber Security Starter Kit Platform

Cyber Security Starter Kit Platform (CSSKP) allows to instantiate new self-assessment products such as Fit4Cybersecurity, Fit4Privacy, Fit4Contract and the like.

CASES Luxembourg 3 Oct 21, 2021
smartpassgen - A cross-platform package of modules for generating, secure storage and recovery of complex, cryptographic, smart passwords on the fly.

smartpassgen - A cross-platform package of modules for generating, secure storage and recovery of complex, cryptographic, smart passwords on the fly.

null 4 Sep 4, 2021
The (Python-based) mining software required for the Nintendo Switch mining project.

ntgbtminer - Nintendo Switch edition This is a version of ntgbtminer that works with the Nintendo Switch bitcoin miner. ntgbtminer ntgbtminer is a no

null 4 Jun 3, 2021
This project aims to assist in the search for leaked passwords while maintaining a high level of privacy using the k-anonymity method.

To achieve this, the APIs of different services are used, sending only a part of the Hash of the password we want to check, for example, the first 5 characters.

Telefónica 36 Jul 6, 2022