A vending machine doesn’t care who you are. It’s a simple machine that serves a simple purpose: To dispense a chosen food or beverage to those that insert the appropriate amount of money. It’s automated – it doesn’t require human intervention, and it knows if it has received the correct value.
It also has an ‘if-then’ type of logic, just in case you gave it too much money; it will process a refund of the excess money in the form of change.
Again, no human intervention required.
This is an example of the simplest form of smart contract. There are two parties to the transaction: The vending machine and you. Because it doesn’t require a human to dispense the food or beverage, the cost for the company supplying the machine is quite low – it’s essentially the cost of the machine plus electricity to run it. Yes, somebody has to occasionally stock it, but it serves as a good example of why there are vending machines all over the world – its simplicity and ability to execute a smart contract without any human intervention or central authority has made it economical.
Now contrast this with buying a car.
It’s not a pleasant experience. It requires a significant investment of time. And even now in 2018 it requires a central authority – a person – to look through various documents. There are many ‘if-then’ circumstances that a human must navigate through: Are you trading in a car with your purchase? That scenario will require a different set of actions than if you are purchasing a vehicle with no trade-in.
Do you need to finance the new car?
Again, that will require a completely optional set of actions that will include approved financing. The central authority involved is usually the finance specialist at the dealership, and they are adept at quickly determining the appropriate steps to take to complete the sale (contract). Technology specialists have enabled almost every facet of business, knowledge-sharing, and entertainment to be convenient and easy, but collectively we still have far to go in the simplification of our legal business dealings with one another.
The team at Ripple has created a solution to this. Before I describe it, let’s talk about smart contracts generally.
What is a Smart Contract?
A smart contract is simply a contract that has been digitized and uses a distributed ledger or a blockchain for settlement. It must have the ability to accept inputs and then update the database (in the case of a smart contract, the database is considered the blockchain or distributed ledger).
Previous to smart contracts, a central party was always involved. This could be a bank, a financial company, or lawyer. Usually, a person representing the organization would determine if all parties to the contract had met their obligation.
For example, when buying a house at a bank, various agreements and documentation is necessary to satisfy regulatory requirements and the needs of all financial stakeholders to the contract. Did the buyer receive the deed? Did the seller receive the money? These facts are important to the overall sale contract for the house. Perhaps a mortgage is involved, and with it mortgage insurance. Each of these variables can be considered components of a complex equation.
A smart contract’s goal is to serve as that central authority.
A smart contract should be able to, once it receives confirmation of necessary ingredients, determine which parts of a contract need to be executed next, or if the contract has been executed successfully. Essentially, a smart contract can be thought of as a computer program that, when given certain inputs, can calculate the end result with deterministic certainty.
In addition, the data – inputs and outputs – can then be stored on an immutable distributed ledger or blockchain. This assures that nobody has tampered with the data or result (immutability), and that the processing is decentralized among a variety of stakeholders (distributed).
How Does Codius Compare to Ethereum?
Ethereum built its smart contract capabilities into its native blockchain code, whereas Ripple opted to create Codius separate and apart from the XRP Ledger.
Stefan Thomas, Ripple’s CTO at the time, described this major architectural difference in a video from 2015. 1 In the video, Stefan Thomas describes that the security model of a cryptographic network is complex enough without adding programmability; he compared this concept to adding programming logic to a database, rather than just using it for data storage. This subtlety ended up defining a major difference between Ripple’s approach to architecting and designing a smart contract platform versus the way that the team behind Ethereum viewed its own project.
You can see from the above diagram that the Ripple team regarded the blockchain that contained the native currency nothing more than the immutable database that contains the result(s) of the contract.
This difference, although nuanced, is profound. Here’s how the Codius website elaborates on the point:
“Previously, most distributed applications in the cryptocurrency community were written in such a way that clients interacted directly with ledgers/blockchains (databases). However, oftentimes applications need to interact with multiple clients, multiple ledgers/blockchains and other Internet services. An application logic layer is the ideal place to host such functionality.”
This means that Codius was constructed not as an additional part of one crypto network, but as a completely separate element that stands on its own. In addition, since it is not tied to a specific cryptocurrency, it can settle with any currency – including fiat. This opens up amazing doors for Codius that are closed to smart contracts on Ethereum.
Codius Interacts with Any Other Network
Codius has two components – a smart contract engine and a smart oracle. The smart oracle can be configured to keep track of nondeterministic information which may affect the outcome of the contract. This complimentary relationship allows for maximum flexibility while not sacrificing security.
Ripple took time away from Codius development in 2016 and 2017 to devote key resources to creating a new payments standard for the Internet. That standard was known as the Interledger Protocol, or ILP. It allows any ledger –whether a bank’s ledger or a cryptographic network ledger – to communicate with outside networks as long as those networks have an ILP plugin. Thus far, plugins have been created for a number of major cryptographic networks, including Bitcoin and Ethereum.
This strategy, while temporarily ceding the smart contracts market to others, provided the basis for completing the Codius architecture; it is now the most interoperable of all the smart contract platforms given its usage of ILP.
From Stefan Thomas, Ripple’s former CTO: 2
“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.”
Because of the Codius separation between the smart contract and the cryptographic network(s) used for contract settlement, David Schwartz, Ripple’s Chief Cryptographer, noted one intriguing difference between Codius and Ethereum: 3
“Another biggest difference, perhaps one of the most important, is that Codius can keep secrets while Ethereum can't. That means Codius can, for example, control a bitcoin wallet while an Ethereum smart contract can't.”
It’s a powerful value proposition for architects and developers that work for banks and other financial institutions; a trustless, decentralized architecture that is secure and flexible at the same time, that can settle in any currency, and on any network or ledger.
Can You Participate?
Yes, you can run a Codius host.
There are no rules about who can or cannot run a Codius host; however, the Codius website provides some perspective and context about why somebody should consider running a host, as well as some of the implications.4
“Running a Codius host means being in the hosting business. You should do it, if you believe that you'll be able to do it well and outcompete others who do the same thing…
…Because Codius is intended for high-security and financial applications, users will be very sensitive to your reputation. You likely won't see a lot of traffic until you have built a record of reliability.”
So although it is definitely an open source project intended to be built upon, keep in mind that there are some technical considerations when setting up your host. To access more detailed information about how to run a Codius host, you can refer to a number of online guides. Here is one from Stefan Thomas himself:
And for those that like videos, here is one from a user that I assume is not connected to Ripple:
For those that are already going through the steps and would like to interact with other developers, I discovered that the ‘Gitter’ room is active with others that are working through projects and activities involving Codius. Here is a link to that room: https://gitter.im/codius/codius-chat
Developers Will Love This
Developers have a mixed reaction to Ethereum, because of multiple factors. Most understand that its performance cannot scale, and they also do not like the requirement that Ethereum mandates the usage of a specific, esoteric scripting language known as ‘Solidity.’
Codius, by contrast, allows developers to use any Turing-complete language they prefer.
How Codius Benefits XRP
Like ILP, Codius emphasizes interoperability.
From what I’ve seen in the crypto space, it’s a common occurrence for those involved to try and build walls around their favorite cryptocurrency and protect it from competition. But that only emphasizes a network’s weakness when compared with others in the same market. It takes a visionary company to invest in the infrastructure that creates an 'even playing field' for the entire market. And with Codius, we see that Ripple (and now Coil as well) is building that interoperability with the full knowledge that it will provide developers with the opportunity to build applications that may settle on other networks than the XRP Ledger.
However, keep in mind that the XRP Ledger is the strongest among the various cryptocurrency networks by a wide margin. Instead of mandating that Codius smart contracts settle with XRP, it was built to allow the developer to decide fully how the contract is settled, and on which ledger.
Which network will developers most likely use to settle smart contracts? You tell me:
Potential Market for Codius
Susan Athey is a Professor of Economics at the Stanford Graduate School of Business, and she is also on the Ripple Board of Directors.6 In a video recorded shortly after Codius’ creation, she stated: 7
“(Codius) is going to really reduce the barriers to entry for creating financial derivative products, and it’s going to allow more people to hedge more complicated situations where there’s not enough people right now to make the market worthwhile to create the asset and have it verified.”
This quote is extraordinary. Not only is she talking about Codius being used for hedging and other derivative products, she is talking about the fact that a low-cost, automated alternative to having an individual or central authority enforce a contract may create entire new markets of derivative products.
Why is this extraordinary?
The current size of the derivatives market is even bigger than ForEx. Most experts put the derivatives market somewhere between 542 trillion and 1,200 trillion. 8 9 Now layer onto that number a possible increase in size due to new markets and derivatives products that may be possible using Codius.
Something tells me that developers with Codius experience might encounter demand for their skills at some point in the very near future.
It is an extraordinary vision that Ripple architected and built from the ground up, when you think of Codius and ILP working together to connect all the various ledgers. Codius is open-source and available for anybody build on; there are no limitations to the new applications, smart contracts, and financial products that can be created on the Codius platform. Enjoy the show from the sidelines, or better yet, chose to play an active role in the Codius community of developers.