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.

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.


  • 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)


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 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 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"


  • 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


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.


View Github