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
CertPy is a high level toolkit for generating x509 (e.g. SSL/TLS/HTTPS) certificates in Python.

CertPy CertPy is a high level toolkit for generating x509 (e.g. SSL/TLS/HTTPS) certificates in Python. Certificate “profiles” are implemented as Pytho

Ryan Castellucci 4 Feb 21, 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
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
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.

4 Sep 04, 2021
Cryptocurrency with implementet Blockchain

Cryptocurrency with implementet Blockchain

Mario 1 Mar 24, 2022
Active github repos of all cryptocurrencies

This repo is to maintain the list of active repositories for all cryptocurrencies that https://codemask.org uses. The active list will be automaticall

CodeMask 5 May 20, 2022
Python wrapper for the Equibles cryptos API.

Equibles Cryptos API for Python Requirements. Python 2.7 and 3.4+ Installation & Usage pip install If the python package is hosted on Github, you can

Equibles 1 Feb 02, 2022
Alpkunt 9 Sep 09, 2022
Certifi: Python SSL Certificates

(Python Distribution) A carefully curated collection of Root Certificates for validating the trustworthiness of SSL certificates while verifying the identity of TLS hosts.

Certifi 608 Jan 02, 2023
Simple one-time pad (OTP) encryption

Introduction What you will make In this resource you will learn how to create and use an encryption technique known as the one-time pad. This method o

Rabih ND 6 Nov 06, 2022
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
Hide secret texts inside an image, optionally encrypt them with a password using AES-256.

Hide secret texts/messages inside an image. You can optionally encrypt your texts with a password using AES-256 before encoding into the image.

Teja Swaroop 97 Dec 29, 2022
📊Python implementation of the Colin Talks Crypto Bitcoin Bull Run Index (CBBI).

Colin Talks Crypto Bitcoin Bull Run Index (CBBI) This is a Python implementation of the Colin Talks Crypto Bitcoin Bull Run Index (CBBI). It makes use

Kamil Monicz 86 Jan 02, 2023
Technical_indicators_cryptos - Using technical indicators to find optimal trading strategies to deploy onto trading bot.

technical_indicators_cryptos Using technical indicators to find optimal trading strategies to deploy onto trading bot. In the Jup Notebook you wil

Van 4 Jul 03, 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
BTCRecover is an open source wallet password and seed recovery tool.

BTCRecover is an open source wallet password and seed recovery tool. For seed based recovery, this is primarily useful in situations where you have lost/forgotten parts of your mnemonic, or have made

2 Aug 18, 2022
Python App To Encrypt Data (image, text, all data)

Python App To Encrypt Data (image, text, all data)

1 Oct 29, 2021
Generate simple encrypted messages!

Premio's Shift is a very simple text encryption, you can use it to send secret messages to your friends. Table of Content Table of Content How it work

Peterson Adami Candido 3 Aug 06, 2021
A hybrid(AES + RSA) encryptor in python.

python-file-encryptor A hybrid(AES + RSA) encryptor in python. Tasted on Windows and Linux(Kali). Install Requirements Use the package manager pip to

Alireza Kalhor 8 Jun 24, 2022
Lottery by Ethereum Blockchain

Lottery by Ethereum Blockchain Set your web3 provider url in .env PROVIDER=https://mainnet.infura.io/v3/YOUR-INFURA-TOKEN Create your source file .

John Torres 3 Dec 23, 2021