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
Aggregate real-time market data from cryptocurrency exchanges, filter, sort and format as TradingView watchlists.

tvbuddy Aggregate real-time market data from cryptocurrency exchanges, filter, sort and format as TradingView watchlists. Developed and tested on Pyth

Ossian Winter 2 Jan 07, 2022
Random Password Generator With Python

Random_Password_Generator example output length

Mahdi Rostami Pooya 2 Dec 22, 2021
An extreme encryption for everyone, encrypt your text before sending to anyone.

An extreme encryption for everyone, encrypt your text before sending to anyone. Alphabets and numbers are going to be encrypted like a hell

Saad 6 Oct 28, 2022
GreenDoge is a modern community-centric green cryptocurrency based on a proof-of-space-and-time consensus algorithm.

GreenDoge Blockchain Download GreenDoge blockchain GreenDoge is a modern community-centric green cryptocurrency based on a proof-of-space-and-time con

40 Sep 11, 2022
Quick and dirty script to fix MD5 hashes in poetry.lock file

fix-poetry-md5-hash Quick and dirty script to fix MD5 hashes in poetry.lock file. Usage: poetry run fix-poetry-md5-hash

2 Apr 20, 2022
Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure

gold-blockchain (Gold) Gold(Gold) is a modern cryptocurrency built from scratch, designed to be efficient, decentralized, and secure. Here are some of

zcomputerwiz 3 Mar 09, 2022
Run with one command grafana, prometheus, and a python script to collect and display cryptocurrency prices and track your wallet balance.

CryptoWatch Track your favorite crypto coin price and your wallet balance. Install Create .env: ADMIN_USER=admin ADMIN_PASSWORD=admin Configure you

Rafael Zimmermann 13 Dec 13, 2022
PeGuard - Windows PE crypter and packing utility

PEGUARD PEGUARD is a file crypter and packing utility. This project was original

11 Nov 28, 2022
A simple script useful to switch from Dashlane to Bitwarden by converting the password file to the right format.

A simple script useful to switch from Dashlane to Bitwarden by converting the password file to the right format.

3 May 06, 2022
Small utility to encrypt and decrypt messages

Safe Safe is a small utility to encrypt and decrypt messages using a pair of public and private keys. Installation You need to have GPG installed in y

Gustavo Eguez 2 Dec 21, 2021
Advanced Digital Envelope System Using Cryptography Techniques (Encryption & Decryption)

Advanced-Digital-Envelope-System Advanced Digital Envelope System Using Cryptography Encryption Techniques The digital envelope system is the techniqu

NelakurthiSudheer 2 Jan 03, 2022
Bombcrypto-robot - Python bot to automate BombCrypto game. Updated 01.02.2022

About: This is an open-source bot, the code is open for anyone to see, fork and

LarkoPa 120 Apr 15, 2022
A python tool to track prices of various cryptocurrencies and alert

CryptoPriceTracker This is a tool to track prices of various cryptocurrencies and alert the user once the user defined maximum & minimum target is rea

1 Oct 01, 2021
The Qis|krypt⟩ is a software suite of protocols of quantum cryptography and quantum communications

The Qis|krypt⟩ is a software suite of protocols of quantum cryptography and quantum communications, as well, other protocols and algorithms, built using IBM’s open-source Software Development Kit for

Qiskrypt 14 Oct 31, 2022
Blockchain with crypto transaction feature

python script that asks users for their name, who they are sending J2 coin too(fictional cryptocurrency) and how much they're sending. it then prints the transaction detail in words and prints the ha

Joshua Stojkovic 2 Jan 10, 2022
keyring MITkeyring (🥉27 · ⭐ 630) - Store and access your passwords safely. MIT

The Python keyring library provides an easy way to access the system keyring service from python. It can be used in any application that needs safe pa

Jason R. Coombs 948 Dec 18, 2022
E2EE disabling plugin for Synapse

E2EE disabling plugin for Synapse This Pluggable Module disables end-to-end encryption in a self-hosted Synapse servers. It works by stripping out req

Konstantin Sharlaimov 9 Nov 30, 2022
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡

⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡

11.2k Jan 09, 2023
基于python的一款 加解密工具

基于python的一款 加解密工具 加密: SHA序列: sha1 , sha2 , sha224 , sha256 , sha384 , sha512 , sha512-256 , sha3-224 , sha3-256 , sha3-384 , sha3-512 MD序列: md4 , md5

3 May 05, 2022
Audit of classmate's smart contract in blockchain seminar

Solidity-contract-audit Audit of classmate's smart contract in blockchain seminar Assignment: The task was to create a complete audit, including unit

smrza 0 Feb 04, 2022