Meet ‘Spedn’ — A Smart Contract Programming Language for Bitcoin Cash
On Wednesday, a developer called Tendo Pein announced the launch of a new smart contract programming language for the Bitcoin Cash network. Pein said “Spedn,” a BCH-based language, is designed for explicitness and safety while having a syntax similar to the C programming environment.
High-Level BCH Smart Contracts
Bitcoin Cash proponents have been introduced to a new smart contract programming language specifically designed for the BCH protocol. The developer Tendo Pein has explained in a recent blog post that one of the difficulties of programming smart contracts with Bitcoin is due to the Script language. Pein said Bitcoin’s Script is a stack-oriented language, similar to the Forth programming language and environment. But instead of giving up, Pein’s passion for the Haskell data processing syntax led the developer to start building Spedn.
“Today, I’m pleased to announce Spedn — A high-level smart contract language for Bitcoin Cash,” Pein declared in his post. “It is designed for explicitness and safety, statically typed and detects many errors at compile time, explicitly typed with no guessing to what the expression is supposed to return. It is purely functional — free of side effects, the common source of bugs, and it has a familiar C-like syntax.”
A Syntax Overview and
Two Smart Contract Examples
Spedn’s documentation is available for BCH developers to review and provide feedback. The specifications give a syntax overview, contract templates, lexical scopes, and more. Additionally, Pein’s work details math functions, hashing functions, cryptographic checks, and the command line interface for compiling. The Spedn documentation further gives developers a quick-start guide and a write-up on understanding Bitcoin Script.
The specifications of Pein’s smart contract language also show examples of using it for zero-confirmation forfeits, a contract based on a proposal by BCH developer Awemany to secure zero-confirmation transactions. Another Spedn example is the Chainbet protocol, which was originally created by Jonald Fyookball. Chainbet is a BCH protocol that enables onchain betting in a decentralized manner. In Pein’s example, the developer said, “the flow of the bet consists of several steps that can be expressed in Spedn.”
Jonald Fyookball’s Chainbet protocol expressed in the Spedn language
Similar to the Ethereum network’s Solidity programming language, the Bitcoin Cash protocol now has a coding language that developers can work with that is specifically designed for BCH-based smart contracts. But the creator of Spedn emphasized that the project is still in its infancy as far as development is concerned.
“Many breaking changes may come and it’s far from being an “out of the box” solution for smart contracts developers,” Pein added. The programmer is looking for contributors who can offer syntax ideas, code review, unit tests, and bug reports.