Where Are Smart Contracts?

Smart contracts have generated a lot of buzz yet you’ve probably never encountered one in your day-to-day. It seems that no important real-world products use them. Why?

You might say: “They’re too new.” But for those of us who have been in the blockchain space for a while, this argument isn’t compelling. I was working on smart contracts in 2013, the same year Docker was released. But smart contracts are still relegated to experiments while Docker and other projects inspired by it run everything including this very website.

My hypothesis for why smart contracts haven’t entered the mainstream is that the architecture hasn’t been flexible enough to deal with the complexity of real-world use cases. Ethereum is an excellent proof of concept, but it’s difficult to integrate with other systems, even forks of Ethereum. And without robust integrations, it’s impossible to build anything more than a proof-of-concept.

A Brief History of Blockchain Smart Contracts

Let’s go back to the beginning to better understand where the current architecture comes from. Bitcoin was released as an integrated payment system that pioneered the blockchain concept including a minimalistic scripting language for smart contracts. After Bitcoin, the technology got its first major upgrade in the form of XRP Ledger, which was the first blockchain to be built on a general purpose key/value map, making it closer to a general purpose database than just a payment system.

I joined Ripple in 2012, and one of my first projects was to build a smart contracts system for XRP Ledger. By April 2013, I had an architecture and a prototype. It was a sandboxed execution environment called ripplevm which used Google’s Native Client to securely run contracts directly in Rippled. Together with the generic key/value store provided by Ripple, this seemed like a promising approach at the time.

Later in 2013, a young Bitcoin developer crashed on my couch for a couple of weeks while visiting San Francisco. In the afternoon, he would come to the Ripple office and join our discussions about smart contracts. His name was Vitalik Buterin. And these conversations led him to incorporate Ripple’s key/value data structure into Ethereum.

People often ask why we didn’t release our prototype, preempting Ethereum and potentially attracting developers to XRP instead. At the time, we underestimated the amount of interest there would be in smart contracts. Moreover, building this architecture seemed daunting — hats off to Vitalik and friends for attracting a community large enough and fervent enough to pull it off.

Codius works differently than smart contracts in Bitcoin or Ethereum.

A Better Architecture

However, there was another reason we didn’t pursue this project: By the end of 2013, Evan Schwartz and I had come up with a new design for smart contracts. This became the Codius project, with a white paper released in 2014.

Today, blockchain smart contracts can’t communicate

Codius works differently than smart contracts in Bitcoin or Ethereum. The contracts run on independent hosts without an underlying blockchain, similar to traditional hosting. This allows them to interact with any service or API, scale infinitely, and read from or write to any blockchain. The key challenge of smart contracts — interoperability — was solved.

There was only one problem: running contracts costs money and we didn’t have a neutral way to pay Codius hosts.

Another benefit of Codius is that it gives the choice of programming language back to the user. Rather than having to write software in strange, special purpose languages like Solidity, developers can write contracts using any common language, including C++, Java, JavaScript, C#, and so on. This massively lowers the barrier to entry and makes smart contracts available to much wider audience.

There was only one problem: running contracts costs money and we didn’t have a neutral way to pay Codius hosts. Picking any single digital asset would have pigeonholed the platform, likely causing it to be shunned by all other communities.

The solution was an abstraction layer that allows users to send and receive any digital asset, fiat currency, or any other kind of value. This is what eventually became Interledger, the open protocol for sending payments across different ledgers.

With Codius and Interledger, smart contracts can make calls to each other

Now that Interledger is completed, we are releasing a new version of Codius. Virtualization technology has progressed a lot since 2014, so this new version is able to run standard containers written in any programming language securely with hardware-enforced virtualization. And the timing couldn’t be better. Many smart contract developers have been reaching out to us over the past few months because they are running into Ethereum’s high transaction fees, high latency, convoluted programming model, and lack of scalability. While searching for a solution, they found the Codius white paper and got in touch.

How Will Codius Be Used?

We founded Coil to build a new business model for the web and created Codius as a tool to help us do it. We are releasing it as open-source because we believe it will be useful for many other companies besides our own. It is the most practical smart contracts platform released to date.

I asked Josh Williams, a serial entrepreneur and investor in the gaming space (Unity, Zynga, Kabam), to help us explain why he’s excited about Codius and he wrote:

“Powerful, scalable decentralized computing and smart contracts interfacing with distributed ledgers are essential for every industry hoping to utilize blockchains and the need is particularly acute for highly interactive, real-time, mass market experiences like games. Teams in games and elsewhere are building on Ethereum and running into the cost and scalability issues we’re all familiar with. Codius has great potential in addressing these concerns, and we are eager to work with it.”

Within the blockchain community, Codius can help make blockchain more mainstream. Another developer, Wietse Wind, plans to use it to create open source tools for the XRP community.

“After 14 years of running my companies serving mid-sized and some large customers with software/system integration (mostly HR and financial systems) I am disappointed in the inefficiency and lack of transparency [of existing smart contracts solutions.] I am excited to develop on Codius as I expect it will allow users to authorize a Codius application to sign transactions on the users behalf. The Codius app will allow users to set fine-grained permissions and limits, without having to expose the users private key to the Codius infrastructure or the Codius application developer. This will allow developers to create a new breed of tools without compromising on security. Tools that can bridge the gap between the XRP ledger and external systems, events, triggers, and data. This could have an important impact on social developments and practical problems.”

Codius could even be used in the enterprise space by companies like Telindus, the ICT arm of Belgian telco Belgacom:

“Codius will push forward novel direct e-commerce models which do not require intermediary services such as online payment services, advertisement services, or similar centralized concepts”, says Thomas Scherer, Chief Architect at Telindus.

Despite the increased functionality, running software on Codius will be cheaper than on-chain on a system like Ethereum. This is because different hosts compete with one another on price and the uploader controls the level of decentralization. A Codius contract can run on an unlimited number of hosts giving it greater decentralization than any existing blockchain can offer. Or it could run on a single host. Each developer can choose the right trade-off between cost and security for their application.

How Can You Use Codius Today?

Codius is open-source and the code is up on Github. If you are a developer and would like to try Codius for yourself, the good news is that it’s incredibly easy to get started.

Did you miss the chance to mine Bitcoin back in 2009? Try running a Codius host and get paid through Interledger when users upload contracts.

If you run into any issues, please visit our Gitter chat and let us know. We’ll do our best to provide support and fix any issues as they crop up.

We’re planning to write more tutorials as we go, so make sure you subscribe to Codius on Medium and follow @Coil on Twitter, so you don’t miss future articles.

Looking to the Future

We realize that in order to be a true alternative, Codius needs to provide easy-to-use modules for achieving consensus and great tooling. We plan to build the consensus part ourselves and we’re hoping you’ll be inspired by the flexibility of the platform and come up with some great projects.

Wired recently predicted the Blockchain will rebuild the Internet as we know it, and while people are right to be skeptical, one comment struck a chord: “Once blockchain technologies mature, they will recede into the background to become one of the fundamental systems powering the internet”. We are only at the beginning. We launched Coil last month to build the web we want. And with Codius we are taking the first step towards providing infrastructure with built-in monetization.

Here’s to smart contracts that aren’t terrible! 🎉