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.

Owner
Kronus91
Kronus91
Basic Ethereum Miner Lib

EthMine ⛏ Basic Ethereum Miner Library. Developers can integrate this algorithm to mine blocks from their ethereum supported chain efficiently. Instal

Jaival Patel 1 Oct 30, 2021
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

11 Dec 23, 2022
Algo-burner - Burner account for the Algorand blockchain

algo-burner Burner address for Algorand's blockchain Apparently it was a problem

1 Jan 12, 2022
Skepticoin is a peer-to-peer digital currency that enables you to send money online

What is Skepticoin? Skepticoin is a peer-to-peer digital currency that enables you to send money online. It's also the central community of people who

64 Aug 06, 2022
Cryptocurrency application that displays instant cryptocurrency prices and reads prices with the Google Text-to-Speech library.

📈 Cryptocurrency Price App 💰 ◽ Cryptocurrency application that displays instant cryptocurrency prices and reads prices with the Google Text-to-Speec

Furkan Mert 2 Nov 08, 2021
A python-jvm wrapper for interacting with the Ergo blockchain.

ergpy A python-jvm wrapper for interacting with the Ergo blockchain. Usage Requires Java 8 or higher to be installed on system pip install JPype1 pip

mgpai 16 Oct 05, 2022
A repository for Algogenous Smart Contracts created on the Algorand Blockchain.

Smart Contacts This Repository is dedicated to code for Alogrand Smart Contracts using Choice Coin. Read Docs for how to implement Algogenous Smart Co

Choice Coin 3 Dec 20, 2022
A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

A Python library to wrap age and minisign to provide key management, encryption/decryption and signing/verification functionality.

Vinay Sajip 3 Feb 01, 2022
A curated list for getting up to speed on crypto and decentralized networks

crypto reading list A curated list for getting up to speed on crypto and decentralized networks. The content on the toplevel page contains what we con

Jump Crypto 1.1k Jan 07, 2023
This is a simple application to generate HD wallet addresses for cryptocurrency coins.

HD-Wallet-Address This is a mini service to generate addresses in the master HD-Wallet. It will use py_crypto_hd_wallet package as a base. Prerequisit

Amin Abbasi 1 Dec 16, 2021
Using with Jupyter making live crypto currency action

Make-Live-Crypto-Currency-With-Python Using with Jupyter making live crypto currency action 1.Note: 💣 You must Create a Binance account and also clic

Mahmut Can Gönül 5 Dec 13, 2021
A curated list of resources dedicated to reinforcement learning applied to cyber security.

Awesome Reinforcement Learning for Cyber Security A curated list of resources dedicated to reinforcement learning applied to cyber security. Note that

Kim Hammar 212 Jan 02, 2023
This is a basic encryption and decryption program made in python.

A basic encryption and decryption program to visualize how the process of protecting data works.

Junaid Chaudhry 5 Nov 15, 2021
A simple program written in python to convert: USD, EUR & BTC to BRL

CoinsPrice This is a simple program written in python to convert: USD EUR BTC to BRL, and I used an API to get coins price. Take a look at the window

Luiz Henrique 1 Feb 09, 2022
Simple python crypto bot to trade crypto on Binance based on RSI. Utilizing web sockets to get real-time prices

Py Crypto Bot Using Binance WebSocket API to get real-time price data for cryptocurrencies. Using the TA-Lib library to calculate the RSI and execute

Kennedy Ngugi Mwaura 15 Jan 04, 2023
Given a string or a text file with plain text , returns his encryption using SHA256 method

Encryption using SHA256 Given a string or a .txt file with plain text. Returns his encryption using SHA256 method Requirements : pip install pyperclip

yuno 3 Jan 24, 2022
Address Validator (Bitcoin & Monero)

The Bitcoin address is an identifier of 26-35 alphanumeric characters, beginning with the number 1, 3 or bc1. 0, O, I, l are removed to avoid visual a

0 Mar 29, 2022
Crypto Portfolio Clustering with and without optimization techniques (elbow method, PCA).

Crypto Portfolio Clustering Crypto Portfolio Clustering with and without optimization techniques (elbow method, PCA). Analysis This is an anlysis of c

David L 0 Feb 18, 2022
Crypto Stats and Tweets Data Pipeline using Airflow

Crypto Stats and Tweets Data Pipeline using Airflow Introduction Project Overview This project was brought upon through Udacity's nanodegree program.

Matthew Greene 1 Nov 24, 2021
A web app to scan crypto markets based on candlestick pattern recognition from

Crypto_Scanner A web app to scan crypto markets based on candlestick pattern recognition from "Japanese Candlestick Charting Techniques: A Contemporar

Chris Qi 27 Jan 01, 2023