Codex – A New Smart Contracts Language

4498

Bitlegal interviewed Philip Saunders on the Codex programming language.

Philip is building Codex as a user-friendly scripting language for legal contracts that can be executed on Ethereum. Codex will work in conjunction with Pax Directory, a membership-based peer-to-peer legal system (including arbitration services) with an integrated cryptocurrency for payments.

Below we ask Philip about where he is with project, its relationship with Ethereum and how it compares with other projects out there.

Is the code live and working on Ethereum?

Partially- there is currently a private chain live on the Ethereum network for testing identity contracts. The project is running in two lanes- Pax and Codex. Pax is a peer-to-peer legal system and Codex is a scripting language for writing executable legal contracts to the Ethereum network. Pax Directory is the UX where people can fill in a profile, buy credits (the native gold-backed token), send broadcasts (like tweets), add other clients as allies, enter into contracts, and resolve minor disputes. There will eventually be a marketplace for resolving more complex disputes. What’s being tested now is mainly the contracts for the directory, but Codex is still vaporware for now. I published the specifications for the script last week.

When will it be ready?

If we are in a position to extend the team, I’m optimistic for a release date of November this year for a working version of the platform.

In simple terms what does Codex scripting language do?

Codex is designed for building legal contracts which are applicable in the high-trust environment of the directory. Pax contracts are interactive with many useful features in the directory: they can act as an escrow (i.e. lock money in a contract until a condition has been met). This is useful for protecting contracts and defending against ‘ghosting’ (abandoning contracts). Codex can make timed and interval payments and can change the status of clients similar to a credit rating. Use cases made possible are autonomous incorporation, employee payroll, rent, subscriptions, billing, restitution, handshake agreements, property transfer, dividend systems, lending, financial contracts and much more. Just like normal text-based contracts we are familiar with, they can define behavioural conditionals, while also being able to handle financial and reputational executables.

Is there an advantage using Codex over directly using Ethereum’s coding language?

Codex is simple, direct and integrated into useful features and a stable currency backed by gold. Smart contracts are just general purpose programs which exist on a decentralized ledger, nothing more. As a Turing-complete language, Solidity and the other EVM languages can do pretty much whatever you want them to do as long as you’re willing to pay for computation on the network. Codex however is domain specific to the needs of a legal system.

I saw that you will have a UX interface to help build contracts but programmers will be able to code directly in Codex. Is that correct?

There will be templates for most common purpose contracts, where you can place blocks to define your own payment logic, intervals, conditionals and consequences. Codex handles the rest. But there will also be a terminal to code directly for more complex contracts as well as an API. The API will allow contracts to be integrated into other services and platforms.

How does your programming language differ to Eris for smart contracts?

In my paper I made a strong distinction between executable contracts and didactic contracts. Didactic contracts are what lawyers are used to drafting – text-based, valid in territorial jurisdictions. Eris Legal Markdown provides a way for the various elements of the didactic contract – parties, witnesses definitions, clauses etc – to be structured into a JSON like document, which can then interact with smart contracts running on private-permissioned Eris databases. The goal of “dual integration” is to have executable smart contract functionality in format which is ultimately valid in nation-state court systems.

Eris is targeted primarily at professional lawyers in existing territorial jurisdictions and is built from the command line, so there is neither disruptive value nor is it making it easier for the public to enter into contracts with each other on a peer to peer basis. Pax is its own jurisdiction, and disputes that arise from contracts are resolved on the platform itself. The advantage of this is that we can abolish legalese: we do not have to defend against all the angles which someone could bring forward litigation in a traditional court. Clients of the directory can also construct their own contracts easily and safely, and have them notarized on a public blockchain which is accessible from any part of the world. Private blockchains are the equivalent of “private internet” ventures in the 1990’s. The difference between Eris and Codex is the difference between Morse Code and Facebook Messenger.

Can you give a few examples of the types of programmable contracts in Codex?

Here is what the syntax for multilateral (many-to-many) Codex contract looks like. Basically it’s a contract between the members of a “club” to vote on what will be the yearly subscription. Every member of the “roll” will receive an option to vote on the outcome in their contract inventory, and whichever outcome wins, the contract defines an action to take forward.

between roll[club]:
clause[1]:
ballot(do[1]: “This motion will raise the subscription fee to 600 credits per year”),
(do[2]: “This motion will lower the subscription to 400 credits per year”),
if do[1] > do[2]:
take 600 every(t + 365),
else:
take 400 every(t + 365).
clause[2]:
etc. etc.

Similar functionality can be used in other contracts to create juries to vote on disputes.

What types of functions can a person code in the smart contract?

The Codex equivalent of “functions” are clauses.

Is it correct that consent is required from both parties to confirm satisfactory delivery took place before funds can be released? What if there is a dispute? Is there an on-hand arbitrator to assist? Are you envisaging having any oracle based contracts?

Contracts can define witnesses. It is possible to name allies from the directory as witnesses who can mediate or vote, like a jury, in the case of a dispute. It is also possible to name professional agencies who will then handle disputes. As for the “deliveries”, that depends. You can lock contracts, similar to a deposit, which secures the contract until the conditionals have been met.

Will Codex only work with Pax?

Yes, Codex is integrated with the features on the directory such as the reputation system and the contract inventory. However contracts will be able to be integrated remotely into other services without necessarily having to log-on to the platform directly, but that is further down the road. To start off with we will build the directory to keep it simple – the market demands Codex be applied within other contexts, we will look at that when the time comes.

Are all payment references in Codex to the native cryptocurrency? What is the name of that cryptocurrency?

The wallet facility on the directory is called the “cache”, and is where users can buy credits. The Troy Credit uses Digix backed gold-to-Ethereum tokens which are denominated in value at 1000th of a troy ounce of gold, so that the denominations will be familiar. Then there are 100 cents per credit. The currency is inspired by the Pound Sterling, which was once valued at a pound of sterling silver before it was debased. So the credit combines the cutting edge features of Ethereum with the old. Having a relatively stable currency is important for contracts, especially contracts that have a long lifespan. Once a contract is finished you can exchange into another cryptocurrency using the Shapeshift API or back into fiat.

Contact Details

Pax
Email: philip@pax.directory

Reddit
Facebook page