HomeCryptoCashscript and smart contracts on Bitcoin Cash (BCH)

Cashscript and smart contracts on Bitcoin Cash (BCH)

Cashscript is a high-level programming language capable of enabling the basic functions of smart contracts on the Bitcoin Cash (BCH) network.

This will allow developers not only to use BCH as a means of exchange in a peer-to-peer system but also to execute condition-based transactions. This week, the Coin Dance website added a new project called Cashscript to the website’s development tracker, so that BCH supporters can get an idea what this programming language is all about.

cashscript smart contracts bitcoin cash

Cashscript’s software engineer and creator, Rosco Kalis, has worked relentlessly on this protocol and a sneak preview of this project’s potential has been shared on Reddit.

Kalis explained that Cashscript is a high-level programming language that adapts to Bitcoin Script. The developer said he was inspired by the Spedn language of Tendo Pein.

“With Cashscript we are mainly focusing on making that integration easier by providing a Javascript Software Development Kit (SDK) that allows you to plug in Cashscript contracts into any web application. For this workflow as well as the syntax of the language we took a lot of inspiration from Ethereum’s Solidity language and Web3.js / Truffle libraries”.

observed Kalis, adding:

“The goal with this is also to make it easier for developers of either community to get involved with the other”.

cashscript smart contracts bitcoin cash

A Javascript SDK allowing developers to easily implement Cashscript contracts in web applications.

Cashscript is still under development and it will take some more time before it is ready for public release. Kalis has indicated that the documentation is almost ready and that it will be released in the coming weeks, allowing developers to begin working on it.

However, he pointed out the fact that there are still many tests to be done and it will take time to make sure that Cashscript is safe to use. The engineer said that most of the work for the compiler was done, but the output of the script is far from being optimised. At the moment, the scripts that are generated are much larger than they are supposed to be.

“The compiled Scripts and SDK should also still be tested more to make sure that they can safely be used — Finally, we’re also still working on creating the documentation for the language and SDK, as we currently only have a few examples online”.

cashscript smart contracts bitcoin cash

What types of transaction-based smart decisions will it be possible to implement?

Kalis pointed out that Cashscript could be used to implement zero-confirmation forfeits, a concept that could reduce the time available to those who want to attempt a double-spending attack.

An example of this is already available in the Github repository of the project. Behind the scenes, the Cashscript SDK uses Gabriel Cardona’s Bitbox library, which manages the operation of Bitcoin Cash.

“For usage, any web application that would like to handle Bitcoin transactions other than P2PKH could use a CashScript contract for that”.

said Kalis.

Cardona said that one of the reasons behind the development of Cashscript is the willingness to support developers of other ecosystems such as Ethereum:

“Since P2SH is BCH’s version of smart contracts we’ve needed a higher level application programming interface (API) for writing Script for a while as writing Script manually is incredibly awkward and error-prone,” Cardona mentioned. The programmer further confided that Kalis leveraged the look and feel of Solidity, hence the API. “[Cashscript] is meant to help talented developers from Bitcoin Cash, Ethereum and other chains create smart contracts with a common workflow and API”.