Spedn: Smart Contracts in Bitcoin Cash

Spedn: Smart Contracts in Bitcoin Cash

Today an anonymous developer announced Spedn, a new contract-oriented language for Bitcoin Cash

While Spedn shares some similarities with Ivy, a smart-contract language developed by Chain for Bitcoin, it supports additional functionalities such as local variables, if/else statements and BCH opcodes that were brought back in May ’18

Smart contracts in Bitcoin Cash?

Before you may or may not get too excited about smart contracts for Bitcoin Cash, let’s make a quick reality check and understand what smart contracts really are because they often sound ‘too smart’ for what they are actually are.

A smart contract on Ethereum is an address that has some code associated with it. You can think of a smart contract as a program, a combination of persistent scripts, or a set of instructions for the Ethereum Virtual Machine. For example, we can use Solidity programming language to write a smart contract that will send 2 ETH to Alice’s address if the contract has 3 ETH. So when we send 3 ETH to our contract, it passes instructions to the EVM and the machine takes 2 ETH from the contract and sends them to Alice. This smart contract is possible because Solidity is Turing-complete, meaning it can express all kinds of logical or arithmetic operations and therefore supports commands like if statements.

Bitcoin also has a language called Script. In a way, Bitcoin addresses are primitive smart contracts that lock your unspent transaction outputs. Script is way less powerful than Solidity and does not support if statements or any other commands that regular programming languages do. However, it was specifically designed so for security reasons and you can still write simple contracts for Bitcoin, as Script can check signatures, calculate hashes and make timelocks. Exchanges use Script to create multi-signature Bitcoin addresses.

So what does Spedn do?

Announced in a today’s post on Medium, Spedn is a new smart-contract language developed by an anonymous developer under the name Tendo Pein. Spedn can be used to write programs for Bitcoin Cash, which can then give instructions to the Bitcoin Cash ‘virtual machine’. By virtual machine, I mean the piece of the Bitcoin Cash protocol responsible for executing Script programs. Spedn supports functionalities such as:

  • if/else statements — control the flow of the program by stating conditions;
  • local variables — temporarily store values;
  • BCH opcodes — are basic operations that were removed from Bitcoin long ago for security purposes but some of them were brought back in May in Bitcoin Cash.

All of the above are not available in Ivy, a similar smart-contract language developed by Chain for Bitcoin.

For now, it is too early to say whether Spedn will gain any popularity but you can already learn the documentation.

By continuing to browse, you agree to the use of cookies. Read Privacy Policy to know more or withdraw your consent.