CashScript v1.0 - Reusable Libraries & Smart Contract Interactions

Campaign

Campaign overview

Funded a year ago
120.00 / 120.00 BCH

CashScript is the high level language used for smart contracts on Bitcoin Cash. Early this year we ran a successful fundraiser to upgrade CashScript for CashTokens. The CashTokens upgrade has generated a lot of interest and enabled a lot of novel projects such as Tapswap, EmeraldDAO, Bitcats Heroes and the FexCash DEX. This upgrade has served as a great baseline, but by looking at the new apps that have been built we can see that CashScript is still missing two key features to enable complex decentralized applications: reusable libraries & smart contract interactions. With this flipstarter we want to raise the funds to develop these two key features for CashScript and enable the next generation of decentralized applications on Bitcoin Cash.

The first feature we want to enable is reusable libraries. This feature exists in almost every programming language and is invaluable for developers to write reusable, safe and maintainable code. We noticed that many of the new applications are implementing similar patterns, and if every developer has to re-implement these patterns into their own contracts from scratch, the chances of bugs is much higher than with reusable and sharable libraries. So this feature will enable developers to write more complex applications with fewer bugs and less time spent on re-implementing the same patterns over and over again. As an extension of this feature, we also want to publish a standard library that can be imported and used by any CashScript contract. The exact contents of this standard library still have to be determined along the way.

The second feature that we want to enable is smart contract interactions. One trend that we've seen in some of these new applications is that they are splitting up the application's smart contract logic into multiple smart contracts, both for efficiency and for separation of concerns. This allows much more complex and interactive systems of smart contracts to be created. However, the CashScript SDK was not designed to allow multiple different smart contracts to interact in the same transaction, so developers had to resort to custom tooling and workarounds. By adding native support for this to the CashScript SDK, we can enable developers to build much more complex and interactive applications on Bitcoin Cash.

Besides upgrading the CashScript compiler and SDK, we will also upgrade the surrounding tooling such as the CashScript Playground and VS Code extension. As a part of this 1.0 Major release we also plan to implement some smaller fixes and improvements, such as improving the estimated transaction fee calculation, making the codebase more maintainable, and the continued maintenance and support until the next network upgrade, May 15th 2024.

Objective

Our objective is to raise 120 BCH to build the v1.0 release of CashScript, which will include reusable libraries and smart contract interactions. The aim is to release the v1.0 release of CashScript alongside or before the next network upgrade, May 15th 2024. If the release is published before the network upgrade, this flipstarter will also include continued maintenance and support until that network upgrade. As with the previous fundraiser, we plan to release a prerelease first that can be tested by the community, before publishing the final release.

Scope

Reusable Libraries

  • Add support for reusable libraries in CashScript
  • Create the start of a standard library
  • Documentation and guides for creating and consuming libraries
  • Update the VS Code extension for libraries

Smart Contract Interactions

  • Keep support for the "simplified" current iteration of creating smart contract interactions
    • This is still useful for simpler smart contracts for which we want to keep the barrier to entry low and support things like automatic UTXO selection
  • Add a new "transaction builder" API for more advanced smart contract interactions that can combine UTXOs from multiple contracts
  • Documentation and guides for creating smart contract interactions

An example of what such an API could look like:

new Transaction()
  .addInput(utxo, contract1.<function>(...args))
  .addInput(utxo, contract2.<function>(...args))
  .build()

Fix Bugs & Maintenance

  • Fix bugs that are reported (such as the estimated TX fee being off by one)
  • Refactor parts of the compiler to make it more maintainable

Compensation

Our requested compensation for this flipstarter is 120 BCH.

Our previous fundraiser was for 100 BCH, but the upgrade ended up being a lot wider in scope and took more time than we initially estimated. We decided to increase the requested compensation for this fundraiser so that we don't run into similar problems for this upgrade.

The requested compensation is split between the following team members and will be used to fund their development time for the duration of the project:

  • Rosco Kalis (Lead Developer): 60 BCH
  • Mathieu Geukens (Developer): 60 BCH

Building The Future

In our previous flipstarter we wrote about the bright future ahead for Bitcoin Cash with the CashTokens upgrade and today, 3 months later, we are starting to see this play out. That flipstarter served as the baseline for smart contracts involving CashTokens, now we want to take it to the next level. We want CashScript to be the tooling that enables advanced smart contracts like AMMs on Bitcoin Cash.

As we wrote before: with a little optimism we see CashScript develop into a thriving ecosystem, with low barriers to entry - unlike writing Script itself - and inviting to experienced developers and beginners alike!

Thank You!

Thanks to everyone pledging to this flipstarter and sharing it with others. Also a thank you to everyone developing with CashScript or simply being an enthusiastic supporter. We hope this fundraiser is successful so we have the finances to dedicate our time to it!