
Codex: A Legal Scripting Language for Ethereum - jarsin
https://medium.com/@PaxDirectory/codex-a-legal-scripting-language-e3723cc76662#.7z4xebqmi
======
pc86
I am in the midst of negotiating an acquisition contract right now (stock
purchase agreement, seller's financing note / stock power, revised
shareholders agreement, etc) as an acquiring party. Non-tech, don't think most
people here would be terribly interested in it.

Based on the low two-digit number of hours I've spent reviewing documents and
on the phone with my attorney so far, there are a lot of issues with the core
idea of this (but IANAL).

> _Where there are disputes, a blockchain can hold an objective record of
> events making dispute resolution relatively trivial_

Good luck. That's sort of the point of contracts in the first place. To easily
be able to say you agreed to something 8 years from now when a
partnership/agreement has gone totally pear-shaped. And we see how well that's
worked out.

> On didactic contracts: _mapping out in detail every aspect of human
> behaviour_

Good luck ad infinitum. That's just never going to happen. And this is why the
first quoted passage is equally unrealistic. There will always be a nebulous
area of a contract, the question is just how big that area is, how nebulous it
is, and whether you're willing to accept that v. spend the additional
resources to clarify it. Which with any negotiation increases the odds the
other party will walk away.

> _Since traditional didactic contracts are mostly unread, they do not in most
> cases involve active consent, which has moral hazard._

Every single word on every page of anything that needs to be signed has been
read at least a dozen times by all attorneys and non-attorneys in this
transaction. I'm not saying everyone reads every didactic contract but even
busy people do not just take their attorney's word for it.

~~~
vinceguidry
Hmm, you bring up some good points. But there's a spectrum of legal disputes,
and a range of outcomes that actors are expecting from adjudication.

Obviously an acquisition is an incredibly complicated transaction, requiring
an enormous amount of effort. The stakes are incredibly high.

There's plenty of low-stakes commercial endeavors that aren't so complicated,
but could still use computerized dispute resolution.

Take a ride share. The people involved are looking to mitigate various kinds
of risk. The driver wants to make sure you won't puke in his car, that he'll
get paid, etc. etc. The rider wants to make sure that the driver has
insurance, that he'll show up on time, and other kinds of guarantees.

So you can set a flexible system whereby should either party break the terms
of the contract, the software provides a path to redress. Each of these
guarantees can be modeled in the software, with systems for, say, uploading
photos with timestamps if the customer actually does puke in the car.

The record, plus the collected history of adjudication results, provides a way
for both parties to come to a conclusion about this particular dispute. Then
both parties can decide whether to accept it and move on, or escalate.

If one chooses to escalate, then the record of the transaction can be pulled
by an appointed arbitrator and then he can add the needed human touch to
create a resolution. Again, if one party is not satisfied, then he can
escalate to an actual lawsuit.

Over years of refinement, escalation, arbitration, the system can be tuned to
such a degree that lawsuits in that arena become practically non-existent.
Profits generated by the system can be re-allocated towards new market-making
activities.

~~~
dragonwriter
> Over years of refinement, escalation, arbitration, the system can be tuned
> to such a degree that lawsuits in that arena become practically non-
> existent.

Sure, but most places that want this can just impose internal dispute
resolution plus binding arbitration via contract, which achieves the same end
without technology.

And imposing this cryptocurrency-based automated dispute resolution plus
arbitration scheme requires all the same social and legal pieces, plus all
parties having access to and trust in a common cryptocurrency-based automated
dispute resolution system as the first step.

It just _adds_ an extra required focus of shared trust compared to the status
quo.

------
twoquestions
While a clearer contract language greatly intrigues me, I'm skeptical on how
effective it would be.

Even the clearest contract is worthless if one party is too weak to hold
everyone to the contract's terms. "What, you want me to pay for the work you
did for me? Come back with a lawyer and we'll talk."

That said, Ethereum looks really cool, and I'd be interested to see what kind
of good they can do.

~~~
lmm
> Even the clearest contract is worthless if one party is too weak to hold
> everyone to the contract's terms. "What, you want me to pay for the work you
> did for me? Come back with a lawyer and we'll talk."

Ethereum solves that: as part of the contract you put the money into escrow,
such that if the work is completed the money is _automatically_ delivered to
the other guy.

Personally I think the problem is on the other side: an automated contract is
all well and good, but how can a computer ever make a judgement as to whether
the work that was done was compliant with the terms?

~~~
TheOtherHobbes
The whole point of law as a profession is to create profitable confusion,
ambiguity, and power differentials. So the idea that you can automate this is
- not impressive.

It might be useful in situations where there is one, and only one, clear,
explicit, strict and agreed interpretation of a contract.

But that doesn't cover most of contract law, where the point of the wording is
often to _disguise and /or hide by misdirection or omission_ legal
implications that can be exploited for profit, or to bully the other party
into believing they have to accept terms without challenging them.

~~~
vinceguidry
> The whole point of law as a profession is to create profitable confusion,
> ambiguity, and power differentials.

That may be a profitable misuse of the law, but it certainly isn't the reason
the profession of law exists. The point of contract law is to allow parties to
cooperate in the pursuit of profitable courses of action. Power differentials
exist, but laws get passed to prevent egregious misuses of those
differentials. That's pretty much what contract law _is_ , is refinements
intended to protect smaller stakeholders.

> to bully the other party into believing they have to accept terms without
> challenging them.

Let me give you an example. I am currently in the process of switching
companies. My boss suggested an arrangement, and when he presented it to the
company, they asked me to sign a separation agreement. The terms of this
agreement, in the document, are to remain confidential for a period of 2
years.

Now, there are a few aspects here that I have to consider. I do not want a
legal requirement hanging over my head for years. Second, I do want the terms
of the agreement and do not want to throw away the deal over it. Third, nobody
wants to sue anybody, nobody is expecting the language of the agreement to
ever see the light of day in court. The company has a specific goal in mind
with the particular language they used on that contract.

This all gives me negotiating headroom. By understanding what the company is
hoping to accomplish, (me not leading an employee charge for better treatment)
I can push for better terms without blowing the whole deal. I was able to
extract a concession down to one year.

But the reality is, I did all that, and didn't gain anything more than just
practice honing my negotiation skills. I'm talking about the agreement now.
Legally, I might be in the wrong, but as the company doesn't care unless
they're faced with the precise situation that the language was inserted into
the agreement to prevent, since I have no intention of doing that, I can
pretty much do what I want.

You can look at their pushing the agreement on me as the company trying to
bully me into accepting terms. There are situations where that might be the
case. I refuse to do business with anyone where I feel the relationship might
turn adversarial. If a relationship were to turn adversarial, with a more
powerful entity trying to extract things from me, I'd exercise mobility and
ingenuity to get out of it and then try to learn from the experience.

But generally, there are plenty of opportunities, especially if you live in
the US, to where you don't have to swim with sharks if you don't want to.

Contracts offer a framework whereby people can collaborate on endeavors that
have the risk of turning into adversarial conflicts, the hope is that by
adhering to the terms, you'll keep the bears at bay. Doesn't always work, but
if your eyes aren't bigger than your stomach it usually works out.

Etherium offers "Contracts 2.0", a way to have micro-interactions that
wouldn't ordinarily happen because they're too legally-risky, the costs of the
risk are far greater than the profit potential. The hope is not to provide
iron-clad assurance that nobody will ever get sued, but to give everyone
involved just a little more peace of mind. That could well be enough to allow
interesting new commercial markets to take form.

------
sewercake
While it's a very cool idea, it seems like using these 'smart-contracts' will
be more trouble than they're worth in the majority of real world situations. I
don't know why this seems to be a use-case of Ethereum that is so readily
emphasized.

~~~
derefr
To me, all of the _other_ use-cases of Etherium are already done better by
other technologies that just focus on those. Smart contracts are Etherium's
killer app, in the sense that, if you want smart contracts, you need Etherium.

------
chrstphrhrt
This is so cool. Hopefully the UX ends up avoiding the pitfalls suffered by
PGP.

I would love to ask clients to "sign here" on a blockchain-enforced contract
before they decide not to pay just because they feel like they can, despite
perfect delivery to their own satisfaction.

~~~
restalis
Can't they choose not to sign and just look for legally non-obliging
alternatives? Etherium tries to sell just the idea of digitizing¹ the legal
contracts, it won't fix the practice of the involved actors!

¹ Digitizing as conversion to digital but locally stored documents like they
did with books doesn't do it with contracts, as these are more than
information on paper, so the digitizing in this case had to address somehow
also the contracts' functional part.

~~~
chrstphrhrt
This is true. I could be wrong, but aren't blockchain transactions publicly
visible?

I was thinking more along the lines of having contract breaches being publicly
visible, which would motivate the more sociopathic egotists of the world to
keep up appearances of fairness. Making it harder to just move to the next
victim because a reputation could be built up.

Edit: also bridging the gap between expensive lawsuits that end up not being
worth it, or the temptation to publicly shame the bullies which is almost
always tacky and never dispassionate.

------
PaulRobinson
I can see multiple applications of this to replace CFDs, options, swaps, even
sports wagering applications. It would provide a public audit trail that can't
be disputed and might actually be _more_ useful for regulators to understand
insider trading, etc. whilst also almost eliminating transaction costs.

What concerns me is the evaluation of the "do" \- what is responsible for
determining if something is "done"? How does contract dispute work within
Ethereum? I can see Gnosis is doing predictive markets work, and I get that in
theory it's possible, but are there mechanisms in order to evaluate whether a
contract term has been met autonomously with Codex or other tools in the
Ethereum world? If so, what are they?

------
Joeboy
Not sure if I understand how this is supposed to work. If I have a eg. rental
contract with a witness, either a) the landlord and tenant have legal rights
which render the contract largely irrelevant or b) the idea is to not have
legal rights anymore, and instead we're paying a trustworthy third party to
adjudicate. Either way smart contracts don't seem to be particularly
attractive.

I'd kind of assumed smart contracts were for things like financial trading
where there are somewhat legitimate electronic oracles and parties are assumed
to be competent, functional adults with an understanding of the risks. I can't
really see it working out in the world of normal people.

------
ivan_ah
Wow, software really _is_ eating the world — even lawyers will have to learn
how to code.

This will be wonderful if it takes off. Imagine a company that issues "hour
shares" based on work contributed. Ok, so Assembly[1,2] didn't work out too
great, but the idea has a future.

[1] [http://assemblymade.com/](http://assemblymade.com/) [2]
[http://web.archive.org/web/20150321002401/https://assembly.c...](http://web.archive.org/web/20150321002401/https://assembly.com/)

~~~
jarsin
from quick glance assemblymade looks kinda like
[http://colony.io/](http://colony.io/) which is built on ethereum.

~~~
Kinnard
Collaboration?

------
bryanrasmussen
It says "The best way to explain Ethereum is by contrasting it with Bitcoin."
but then it never does the contrasting. I'm supposing they meant they part
where it says "It turns out that this approach can also be used to create
binding self-enforcing legal contracts between people..." but that isn't
contrasting with bitcoin, since they say it is something that is enabled by
the approach of bitcoin. I mean it got me to go read about Ethereum but I am
still confused by that line about contrasting bitcoin with Ethereum as the
best way to tell me what Ethereum is.

~~~
dev1n
The Bitcoin network doesn't really want users to develop on the bitcoin
blockchain. Whereas the sole purpose of ethereum is for you to develop
distributed apps on its blockchain. That's the contrast.

~~~
bryanrasmussen
so does this mean ethereum's blockchain works exactly the same as bitcoin's
but they are committed to people building apps on top of their blockchain? But
theoretically the applications could be built on top of Bitcoin's blockchain
but the community doesn't provide support for it ( for example no easy
scripting language like this post details?)

~~~
dev1n
There are definitely some major implementation level differences between
Ethereum and Bitcoin. The hashing mechanism (Ethash) is quite different from
Bitcoin, as well as how references to previous transactions are stored. You
can read more about it here [1] and here [2]

[1]: [https://ethereum.gitbooks.io/frontier-
guide/content/](https://ethereum.gitbooks.io/frontier-guide/content/)

[2]: [http://gavwood.com/paper.pdf](http://gavwood.com/paper.pdf)

------
YeGoblynQueenne
>> SOCIAL CONTRACTS (sovereign, high-trust) is the basis of the authority of
sovereign territorial monopolies. Essentially theological in nature,
unwritten, undefined, unconsented to. Institutionally epitomized by a Head of
State, or “Leviathan”.

I've been thinking of something similar, basically a formal language to hold
authorities accountable and consistent in their actions. Sort of an
instruction set for government.

But, realistically speaking, trying to put an API on top of human behaviour is
not easily done and it will most probably not lead to more happy humans.

~~~
physes
You don't need a government. People can enter into contracts with each other
or with agencies and property owners. Pax allows for law and dispute
resolution without the need for a nation state.

~~~
YeGoblynQueenne
OK, I hadn't realised that.

So, how do you implement Pax's resolution if one party refuses to accept it?

------
nkrisc
I still don't understand how disputes are resolved, particularly regarding the
"do" statements. Take it to court and try to show breach of contract?

~~~
onetwotree
Right, it seems to gloss over this rather obviously in the lease example. The
'take rent every month' clause just seems like an overengineered automatic
payment system.

The interesting clauses in leases are the ones that require tenants, for
example, not to trash the place, and landlords to fix things in a timely
fashion, not enter without 24 hours notice, etc. These disputes seem to
require a human arbitrator to determine, for example, who's fault the damage
to the apartment is.

------
libertymcateer
I'm a lawyer and erstwhile software dev.

Edits in italic: _The idea that this will catch on in any non-trivial fashion_
is such flagrant nonsense that I don't know where to start. _Note that I didn
't see the author of this page saying that it will, but a lot of comments seem
to indicate that this is the hope._

Most of law school is dedicated to being hammered over the head, repeatedly,
with the fact that contracts constantly use this word:

 __REASONABLE __

And many, many thick books written by a lot of very smart people have been
dedicated solely to trying to define this word, which is hotly debated.

Quite simply, contracts are semantic documents that are used as reference for
judgment based processes. Syntactic interpretation simply is never going to
work, and that is all blockchain is going to get you. The existence of closing
conditions to big deals (e.g. company sales) require _human judgment_ \- they
are often things like "the reasonable likelihood that there is no need for
further tax indemnification" or "there is reasonable likelihood that there
will be no further suits filed against [x]". How in the hell is a computer
_ever_ going to make determinations about the reasonable likelihood of human
actors that are sufficient to have as bases for contract conditions? And even
if they can, is that what you _want_? I still want a human's finger on the
trigger. And either way, until you have true AI interpreting contracts for
you, this is a completely hopeless task. It so fundamentally misunderstands
what attorneys do that it is just worthy of being dismissed out of hand.

Let's put it this way: saying that contracts can be 'coded' in this way is the
exact same as thinking that all software developers do is write code.

I spend at least as much time writing contracts as I do trying to figure out
what the heck it is that is actually going on, investigating, documenting
requirements, satisfying stake-holders - it is not, unlike, in fact, writing
software.

So, in essence, saying that contracts can be automated is literally the exact
same statement that software development can be automated.

Show me how. I will make you wealthy beyond the wildest dreams of avarice.

NB: you may not read the TOS - but trust me, as someone who has written many,
many website TOS's, people do read them. Important people, like states
Attorneys General, representatives from acquiring companies and competitors,
attorneys representing people who are trying to sue you and members of the
general public who actually give a darn about their privacy. And, quite
frankly, TOSs are a tiny fraction of what I do - and I have a very brisk
software practice.

The vast majority of actual commercial contract negotiation is in documents
that are _heavily_ worked upon by both sides and reviewed many times by
multiple people. If you think you can get even 20% of these people to become
effective at writing _markdown_ much less learning logical operators, well, I
have a bridge to sell you.

~~~
darawk
I think the idea is that it would not replace all contracts, just certain
contracts that happen to have narrowly definable and executable terms.

E.g. An assurance contract a la kickstarter (for the most trivial case),
options contracts, or multi-party escrow.

And that perhaps the scope of its capabilities would expand incrementally over
time as people got better at thinking about contracts in this way.

An analogy might be to Squarespace/Wordpress for web developers. Sure, you
can't make every website on there. But for a lot of simple cases you can, and
those cases are expanding.

~~~
libertymcateer
I follow, but what I deny is that there is a big overlap in people who are
sophisticated enough to understand both the legal requirements of contracts,
have the ability to work within this technical framework and _still think that
having these sorts of things be totally automated is a good idea_.

Putatively, I should be a prime candidate. I spend my nights and weekends (to
the extent I have them) working in node and jquery, I cut my teeth on ANSI C
two decades ago, I studied math and physics as an undergrad and now I'm a full
time lawyer.

I am deeply, deeply hesitant to use this kind of agreement. It is not that the
systems we have are ideal - they are definitely flawed - so my attitude is not
that "if it ain't broke, don't fix it." The attitude is that of "this is
likely to introduce way more risk and uncertainty into processes that are
already risky and uncertain."

Let's put it yet one other way: if the point of this language is to make
things _clearer_ \- it fails at the starting line, for the simple reason that
90%+ - probably 99% + - of people that have to deal with contracts cannot make
heads or tails of a logical operator, and teaching them to do so with enough
comfort that they can parse and evaluate such statements at anything near the
speed necessary for commercial applicability is a sisyphean undertaking.

~~~
darawk
While I agree, I think you could make similar arguments about the contents of
legal contracts today. The overwhelming majority of users of say, Kickstarter
or online stock brokerage systems do not read the contracts they are asked to
agree to, and if they attempted to would be incapable of understanding them
anyway. So I think that argument is a bit of a red herring.

The advantages of Ethereum are in eliminating 3rd party trust and the costs
that come with it. Right now if you want one of these simple financial
services, there is both a direct financial cost associated with it and the
implicit risk-expense of trusting someone else with your money. This is a
drain on the global financial system that just doesn't need to exist anymore.

The idea that Ethereum or things like it will supplant the legal system is of
course, absurd on its face. That will not happen. But what we may start to
see, in my opinion, is the co-mingling of the two, and contracts being written
with deterministic, executable components alongside more traditional legal
verbiage.

Fundamentally there are some things that are amenable to mechanization and
some things that are not. But right now _both_ are encoded in human language.
And the use of either one for the other's optimal purpose is perverse and
unnecessarily expensive.

------
VMG
Interesting idea, but as far as language descriptions go, I'm underwhelmed. A
list of keywords, no good description of syntax and semantics.

I'd rather see a DSL embedded into an existing language with clear semantics.

------
Kinnard
Beautiful!!!

