over budget
rewrite it in zig - cardano-ledger
Current Project Status
Unfunded
Amount
Received
₳0
Amount
Requested
₳142,132
Percentage
Received
0.00%
Solution

We propose the realization of such tools in the modern language of Zig (interoperable with C/C++ codebases), which will serve as a base for performance-focused applications.

Problem

Onboarding new developers is easier when they have tools they can use in their favorite language.

Feasibility
Value for money
Impact / Alignment

Team

2 members

rewrite it in zig - cardano-ledger

Please describe your proposed solution.

The cardano-ledger can be seen as a set of rules that specifies how data on Cardano is expected to be stored and or used;

A Zig implementation would allow for one of the most efficient implementations of these rules; it would be the core dependency for any upcoming Zig project that wants to interact with the blockchain; especially through the creation of transactions.

Why Zig?

The choice of Zig as a language is mostly due to the incredible performances it can achieve (often comparable to C) with a strong focus on memory safety and best practices (errors as values, no hidden control flow, etc.);

Despite being a relatively young language (Zig development started in 2017) the characteristics of the language are allowing it to easily be adopted by the industry with lots of exciting projects, including the blazingly fast javascript runtme "Bun" with over 42k stars on GitHub.

TL;DR: adopting Zig means making sure that Cardano stays at the forefront of industry standards.

How does your proposed solution address the challenge and what benefits will this bring to the Cardano ecosystem?

In the challange description, one of the "possible directions" specified is;

> Developing common tools, frameworks, core infrastructures, or proof of concepts

which matches the idea of the proposal to create a tool that can work as a base for any other project who intends to use the library.

How do you intend to measure the success of your project?

The final goal is to have an open-source library to be reused across the ecosystem.

As an open-source project, the most direct way would be the number of stars the project will receive on GitHub; indicative of the people interested in it.

As a library, the number of dependent projects (directly or indirectly) will be an incredibly useful metric.

Please describe your plans to share the outputs and results of your project?

So far Twitter has been mainly used to communicate the progress of the various projects.

Mainly the (personal) MicheleHarmonic account will be alongside the HarmonicLabs account where appropriate.

Twitter has proven itself a useful tool to share the progress and it will still be used.

for any unreported progress, the project itself has always been open source, and anyone interested should be able to use GitHub to stay updated; the repository can be found at: ( TODO insert link of repo )

What is your capability to deliver your project with high levels of trust and accountability?

We are already working on the implementation of the cardano-ledger in Typescript while the implementation has its use cases it is definitely inconvenient to be used in a scope where resources are limited, hence this proposal.

What are the main goals for the project and how will you validate if your approach is feasible?

We will be following the upcoming era CDDL specification (conway).

The main goal of the project (and also the main deliverable) is a Zig library that defines the datatypes necessary for any application that wishes to integrate or interact with Cardano.

The proposal also includes a transaction builder higher level API (to build easily lower-level transactions).

Ideally, the transaction builder will be defined in a separate module dependent on the cardano-ledger one.

Please provide a detailed breakdown of your project’s milestones and each of the main tasks or activities to reach the milestone plus the expected timeline for the delivery.

The library will define all the data-types specified in the CDDL specification (conway), alongside all the required CBOR (de)serialization.

for the seek of clarity we are reporting the major ones here as milestones (many minor types have been omitted with the goal of keeping the answer concise):

  • block
  • transaciton
  • header
  • operational_cert
  • voting_procedure
  • proposal_procedure
  • governance_action
  • voter
  • script_data_hash
  • address (and bech32 string format support)
  • certificate (all of them)
  • pool_params
  • withdrawals
  • protocol_param_update
  • plutus_data
  • costmdls
  • transaction_metadatum and auxiliary_data
  • native_script
  • multiasset (Value)

the proposal will also include the transaction builder

  • transaction builder

The process of building a transaction will include phase 1 validation ( balanced transaction ) but not phase 2 ( script execution ); as it would require a Zig implementation of the Plutus Machine;

Phase 2 validation is totally possible and will be integrated once the proposal has been completed (possibly but not necessarily under a following proposal)

Please describe the deliverables, outputs and intended outcomes of each milestone.

As mentioned above, the main deliverable is the Zig library that defines all the necessary data-types and respective CBOR serialization/deserialization.

Everything will be open source, hence the outputs of the project will include the repository, where eventually everyone will be able to verify the work done.

Please provide a detailed budget breakdown of the proposed work and resources.

The total cost of the project is estimated to be 142,132 ADA;

The amount has been calculated as follows:

The total amount of ADA allocated to the challenge is 3,158,500 ADA.

To operate with a price that is not subject to volatility over time we are assuming that corresponds to an allocation of 1,000,000 $

that would roughly correspond to a price of 1,000,000 / 3,158,500 = 0,316605984 $/ADA

or equivalently 3,158,500 / 1,000,000 = 3,1585 ADA/$

At a cost of 45 $/h (after taxes);

Since the legal entity operates in Italy we'll consider a 22% standard tax due to VAT (see source on agenzia delle entrate)

45 · (100 / (100 - 22)) =

45 · 100 / 78 =

4500 / 78 ~= 57.692 $/h

The estimated timeline for the final product is of 6 months.

assuming 6h of work a day; for 5 days a week, for 26 weeks in a 6 months period, the following should be the total cost for the project (in dollar value):

57.692 · 6 · 5 · 26 = 44999,76 $

At a rate of exchange of 3,1585 ADA/$ it becomes:

44999,76 $ · 3,1585 ADA/$ = 142131,74196 ADA

Who is in the project team and what are their roles?

Michele (main proposer) will be mainly responsible for the implementation.

Michele is also the founder of the Harmonic Laboratories, which has been working (and is still working) on several projects on Cardano.

If necessary, and if possible, the workload will be distributed between the developers at Harmonic Laboratories.

How does the cost of the project represent value for money for the Cardano ecosystem?

The extension of Cardano as an ecosystem to a modern programming language like Zig will allow for greater diversity and inclusivity in the developer community, allowing people with different backgrounds and educations to contribute to the protocol.

Allowing the emerging Zig language to be part of Cardano will be a great entry point for some of the greatest engineers and brilliant minds looking for innovation.

close

Playlist

  • EP2: epoch_length

    Authored by: Darlington Kofa

    3m 24s
    Darlington Kofa
  • EP1: 'd' parameter

    Authored by: Darlington Kofa

    4m 3s
    Darlington Kofa
  • EP3: key_deposit

    Authored by: Darlington Kofa

    3m 48s
    Darlington Kofa
  • EP4: epoch_no

    Authored by: Darlington Kofa

    2m 16s
    Darlington Kofa
  • EP5: max_block_size

    Authored by: Darlington Kofa

    3m 14s
    Darlington Kofa
  • EP6: pool_deposit

    Authored by: Darlington Kofa

    3m 19s
    Darlington Kofa
  • EP7: max_tx_size

    Authored by: Darlington Kofa

    4m 59s
    Darlington Kofa
0:00
/
~0:00