Last updated a year ago
Developers without Haskell experience need to spend months in learning Haskell before they can productively build dApps on Cardano.
Create a library for developers to write off-chain code in Python, so they can be freed from learning and writing off-chain code in Haskell.
This is the total amount allocated to PyCardano - Build dApps in Python.
PyCardano will provide developers with APIs to write entire off-chain code for their dApps in Python. For Python developers, it means instead of spending weeks or even months in learning advanced Haskell, they can now build dApps in days (see more details and explanations in next section).
The library will have core functionalities that enable developers to:
Apart from core functionalities, we will also create two end-to-end educational dApps that can be directly deployed to testnet or mainnet. The dApps will be similar to the ones in Plutus pioneer program [1], but with all off-chain code written in Python. To get a sense of sample dApp, check out this example dApp built by the proposer: https://github.com/cffls/pycardano/tree/main/examples/full_stack. The linked dApp is built with PyCardano. Users can send ADA to multiple addresses with Nami wallet, which is impossible with Nami wallet alone.
[1] Plutus pioneer program: https://testnets.cardano.org/en/plutus-pioneer-program/
A complete Cardano dApp usually consist of two main components: 1) on-chain Plutus script(s), which usually defines the core business logic of the dApp, and 2) off-chain code through with users' wallets will interact with the Plutus script.
Plutus application backend (PAB) provides an all-in-one solution where developers can write Haskell code for both on-chain and off-chain code. However, off-chain code requires non-trivial understanding of Haskell, such as Monad [1] and type families [2], which means weeks, if not months, of learning for new Haskell developers to fully master. Additionally, off-chain code is usually more complex and longer than on-chain code, because it is responsible for handling all use cases and scenarios for users to interact with Plutus scripts. Hence, for developers without prior Haskell experience, it will take a significant amount of time to learn, write, and debug off-chain code. A supporting evidence is that Plutus pioneer program is a ten-week long program, and there is a week dedicated to Monad [3]. The steep learning curve of Haskell does not only affect development speed, but also discourages new developers who want to build on Cardano, and could potentially slow down developer adoption.
What if we provide developers with a library by which they can write all off-chain code in one of the most popular programming languages, Python? Instead of spending time on learning advanced Haskell, developers can write simple Python code, and building dApps suddenly becomes much easier! Thousands of Python developers will be able to quickly learn, understand, and build Cardano dApps, not in weeks or months, but in days.
Some people might ask if using Python will jeopardize the security of Cardano's smart contract in a certain degree. The short answer is no. As a reminder, on-chain code will still need to be written in Haskell/Plutus, and only the gigantic off-chain code will be written in Python. The main security of Plutus script is coming from its on-chain part, which basically determines Who, How, and When could the locked fund be spent. This part is intact and therefore secured. Only the off-chain part will be written in Python. A resulting benefit of such combination is that developers can enjoy the security brought by Plutus and the easiness and simplicity brought by Python.
[1] Monad: https://wiki.haskell.org/All_About_Monads
[2] Type families: https://wiki.haskell.org/GHC/Type_families
[3] Plutus-pioneer-program, Monad: https://github.com/input-output-hk/plutus-pioneer-program#lecture-4
Potential challenges:
There will be three milestones for this project: 1) core Plutus Python APIs, 2) Plutus Python SDK, 3) educational sample dApps. See below for details of milestones and their deliverables.
Core Plutus APIs in Python (12 weeks). This milestone provides all necessary Python APIs for developers to create script transactions.
Deliverables:
Plutus Python SDK (6 weeks). This milestone provides toolings for developers to create, test, and manage their projects in shorter amount of time.
Deliverables:
Educational dApps (8 weeks). This milestone introduces the Python library to a broader audience by showing how to use the library in real working dApps.
Deliverables:
Total budget: $104,781
Budget breakdown
The budget consists of two parts, software development cost ($104,000) and cloud computing cost ($781). Please see the details below.
Software development cost
Total: $104,000
There will be three milestones in this project:
We are aiming to create Python SDKs with highest standards, which means:
Considering all functional and non-functional requirements, we need a full-time senior software engineer to work on the project for 26 weeks. With current market rate in the US, this translates to a budget of $104,000 in total (26 weeks x 40 hours/week x $100/hour).
Cloud computing and storage
Total: $781
In development, large scale testing and experiments require cloud computing resources. We will use AWS EC2 to host cardano-node and cardano-db-sync (or its alternatives).
Computing budget: $521
One t3.xlarge instances for cardano-node and one t3.2xlarge for db-sync (32GB ram required [1]) for for 40 hours per week and for 26 weeks in total. Calculation: [$0.167 (t3.xlarge hourly rate) + $0.3341 (t3.2xlarge hourly rate)] x 40 hours x 26 weeks. [2]
Storage budget: $260
200GB General Purpose SSD (gp2) for two EC2 instances.
Calculation: 2 x 200GB x $0.1/GB-month x 6.5 Months [3]
[1] cardano-db-sync hardware requirement: https://github.com/input-output-hk/cardano-db-sync#system-requirements
[2] AWS t3 instance rates: https://aws.amazon.com/ec2/instance-types/t3/
[3] AWS EBS rates: https://aws.amazon.com/ebs/pricing/
Jerry Chen, a senior software engineer with many experiences Cardano. He built PyCardano [1], a lightweight Cardano library in Python built with his passion in Cardano and blockchain. The library already supports many features, such as transferring funds and minting NFTs. He also created many sample Python scripts [2] that shows how to use PyCardano. This proposal is a continuation of PyCardano, whose ultimate goal is to provide the best Cardano developer experience for Python programmers.
Although PyCardano is not previously a Catalyst proposal, it has gained lots of tractions from the community. Since its first release on 2/15/2022, there has been more than 400 PyPI downloads in a month [3], which showed the strong demand of this tool among developers, as well as the quality and usefulness of this library.
[1] PyCardano: https://github.com/cffls/pycardano
[2] PyCardano examples: https://github.com/cffls/pycardano/tree/main/examples
[3] PyPI download stats: https://pypistats.org/packages/pycardano
The progress and development of this project could be tracked by the completion of each milestones listed previously.
12 weeks after funding:
18 weeks after funding:
26 weeks after funding:
This is an entirely new Catalyst proposal. However, this proposal is a continuation of the development of PyCardano, an open source project the proposer has been working on for free in the past couple of months.
NB: Monthly reporting was deprecated from January 2024 and replaced fully by the Milestones Program framework. Learn more here
The idea proposer created PyCardano, a lightweight Cardano library in Python. Developers can already use the library to build transactions and mint NFTs. The repository also provides many working examples for developers to learn basic usages the library.