Skip to content

More than you want to know about smart contracts

March 9, 2017

First of all.  Just to rattle the tin cup.  I’m looking for consulting
work or any other form of sponsorship so that I can keep working on
this sort of thing.  In particular, I seem to be the only person in
the world that is willing to put up a blog post saying that they will
show you how to money out of Mainland China with digital currencies,
and so if that’s interesting to anyone send me an e-mail.

Ask me about that.

This is going to be long, but I’ve tried to put in the most important
stuff first, so that if you get bored with all of the details, you can
tune out.

Now here is the smart contract that I’m using to fund KuaiFit

https://gateway.ipfs.io/ipfs/QmNYhXfwMKAnvKEq7nJL8651giWv8UBbF4jrU71Us5VJ9z/display.html

and the signature sheet

https://gateway.ipfs.io/ipfs/QmaNcpjE5Ztww6tyzKYLteo7BWvq9UwUFZYwKZ3mdYwq8y/

Here is more information about KuaiFit.  They just won the TiE Global Asia competition.

see http://kuai.fit/

This is not a solicitation, but for informational purposes only, I would like people to know that they are currently in the middle of an angel fund raise for professional investors, and with the the smart contract convertible notes, you can invest with as little USD 1k.  The important thing about these contracts is that I’m trying to create a market for commercial paper for small companies.  The notes are set up so that you can buy the notes and hold for some period of time and then resell them and collect any extra interest.  I’ll go into some details about how the notes work with small business financing.

Also, again this is not a public offering, in order to invest, you must be a HK professional investor.  However, it’s possible that you are a professional investor and not know it, so we can have that discussion

Here is the smart contact that I had to enter into submit to the judge
when I went to court for my money lending license.

http://joequant.github.io/bitquant/smart-contracts/contract_viewer.html?contract=models/hk-money-lender

Here is my argument for the court case (in which the Department of
Justice settled) in which I argued that the Police were acting
unconstitutionally.

Argument for Money Lending License

But in addition to this issue, there are a number of innovations in
the money lending smart contract.  First of all, it turns out that
Hong Kong has a number of specific legal requirements that makes it
hard to amortize money lending loans, but this technology lets you do
that.  Second, because of the requirement that the loan contract must
print of the effective interest rate, having an interactive contract
is the only way that you can issue a money lending loan with a
variable interest rate.

Also one reason I won is that I outteched the HK government.
Basically, I could use http://www.bundledocs.com to generate my trial bundles
and the HK Department of Justice didn’t.  The fact that I could page
number my documents in seconds and create a single PDF file, whereas
the HK government took hours to hand page number their documents gave
me a huge advantage.  The fact that it’s my own case and data, means
that I could use http://www.bundledocs.com, whereas you are talking about
years of hearings and policy consultations before they could do that.

If you want to see other smart contracts….

https://github.com/joequant/bitquant/tree/master/smart-contracts

== Business models ==

One of the funny things is that with everyone talking about smart
contracts, I’m having extremely an extremely difficult time finding
someone to fund me and I’m just barely scraping by.  There are tens of
millions of dollars being spent on blockchain, most of which I think
is being wasted, but I’m not seeing much of it, and it’s interesting
to see why.

Part of it that I feel like I’m a flying saucer salesman.  If you are
selling flying saucers, you might go out of business because no one
has the infrastructures to fly flying saucers.

First of all, you have banks that have capital expense accounts, but
they don’t need this technology, and so all of that capital expense is
going to do things which frankly I don’t think are going to be of any
long term benefit.  Also banks have structural problems with
technology, and if you become too integrated with the banks, you get
infected by their dysfunctions which kills any benefit from your
technology.

You have asset managers that could really use this technology, but the
trouble is that because margins for asset managers are so low, they
can’t put capital expense into R&D.  And you get hit by raw numbers.
If you are an investor, you can make 10% return on assets.  If you are
a fund manager, you make 1% return on assets.  If you are a tech
provider, you make 0.1% return on assets.  That means that to fund USD
100k/year, you need USD100M in assets, at which point, you don’t need
any new tech.  Also, it turns out that using this tech would require
the fund managers to fundamentally change their business processes
which would be quite disruptive.  It also turns out that the asset
managers are in some since held hostage by the banks.  If you are an
asset manager, you need a custodian, the custodian needs a bank
account to manage cash.  The bank imposes conditions on the custodian,
which imposes conditions against the asset manager which means they
can’t use new tech or worse yet explore new business processes.

So one reason it turns out that this is it’s important that I can use
my own money to underwrite all the capital investment.  However, since
I’m using retirement money, I can’t use that to fund my daily
expenses.

Second, there’s no obvious place to put a toll booth, and without a
toll booth, the google/VC model won’t work.

The Hong Kong government has a ton of money, but it turns out that the
grants aren’t that great if you compare them to the amount of time and
effort involved in applying for the grant, it becomes non-productive.
I’m already getting buried in bureaucratic form-filling nonsense.  One
thing that I’ve been trying to do is to come up with a system for
dealing with that, and making the grant process more efficient.  There
are plum grants, but those are earmarked for institutions and I can’t
get any of them.

Finally, I’m highly opinionated.  It’s hard for me to work on a
project which I think is doomed to fail, and about 90% of the
blockchain projects out there just won’t work for some basic and
fundamental reasons.  I think the big players aren’t going to be able
to get anything done with some of the projects they are working on.

So what I’m doing is scraping by doing programming and consulting
work.

But with that out of the way…..

== So what’s the big deal ==

Your first reaction is that hey, this is just a boring contract.  There’s nothing special here.  But an important part of the technology is to make it look boring.  You want everything to look as much as you can like a boring old contract.  When I showed this to the judge and the HK Department of Justice, I *didn’t* want them to see anything other than a boring old contract, and I consider this a successful use of the technology, because none of them knew or cared that I was doing something with weird technology.

But key thing is that I can take this contract to automatically machine process it.  I can put it into a custom viewer that integrates the contract with other data to give you nice displays.  I can take 1000 of these contracts, and then run risk analysis.  I can take a bundle of these contracts, create a securitized product, and then the buyer of the product can look at where all of the cash flows come from.  You can plug it into a settlement system and have the contract move money if that’s what you want.

Think of the iPhone.  If Apple marketed it as a “multi-functional communications device” it would get them nowhere.  But it’s a phone.  You pick it up and call people.  It turns out that you can do other things with it, but if you want to see it as a phone, then it’s a phone.  This looks like a boring old contract, and that’s an important part of the technology.  VC love it if you pitch new and crazy technology.  Judges don’t.

== The anatomy of a smart contract ==

One of the questions that I’ll go into is how you litigate a digital
contract in a world in a system of paper trial bundles.  But first,
here is the layout, and the layout is designed to solve a very simple
problem.  I do a loan with someone.  When I want my money, the person
claims that they didn’t understand what they were signing.  At that
point, we might go to a judge, but if the judge doesn’t understand
what is going on, then I’m doomed.

So….  Here are the parts of the contract:

1) The contract itself which is code that is written in javascript.
There are legal reasons why we chose javascript.  You can write a
contract in any language, but if you write the contract in a language
that few people can read, you are going to have headaches in
enforcement.  We used javascript as the contract language because a
lot of people can read javascript, which reduces the cost of
litigation.  In addition, many of our contracts are with high tech
businesses, and if the company has a web developer or can find a web
developer, it’s really hard to argue to the judge or arbitration
panel, that they didn’t understand the contract.

2) A contract viewer that takes the contract code and formats it.  You
can write different contract viewers, and a sophisticated viewer could
take out the contract conditions and plot them out graphically.  The
contract viewer is written so that you can load in the contract in any
web browser, which means that if you were litigate the contract, you’d
have people just pull up the contract in their web browser.

Also the contract viewer could be set up to automatically process the
contract and move money or do whatever

3) A commentary on the contract.  This is a “plain english”
explanation of the contract.  It’s deliberately separate from the
contract itself.  The reason for this is that I can provide a warranty
to the initial holder of the contract that it behaves a certain way.
However, if I were to resell the contract to a big bank, they have
lawyers and coders, and I don’t want to guarantee anything.

4) Signature sheets.  We upload the contracts, digitally hash the
code, have two papers of physical paper and sign everything with a
pen.  Paper is good technology sometimes.

Also if you want even more legal notes

https://github.com/joequant/bitquant/blob/master/smart-contracts/NOTES.md

== But where is the blockchain? ==

So you might ask how the blockchain fits into this?  Well we use a
blockchain like technology to record the contracts, but we don’t need
a blockchain.  The analogy that I have is that we are creating an
automobile rather than a train.  Now if you have an automobile, it
would be *nice* to drive the car on a freeway, but if you have just
dirt roads, you can still operate a car.  It’s important for these
contract to work for them on dirt roads while we wait for someone to
build the freeway.

But right now the main blockchain technology that we are using is
IPFS.  It turns out that IPFS is really, really useful, because it
gives a unique ID to any contract or document.

This gets into one of the problems with the smart contract
infrastructures.  What does it take to do a contract?  I can go down
to the stationery store, get a form contract and sign it with someone,
and it will cost me basically HKD 50 for the form.  If it turns out
that in order to do a contract, you have to have an entire
infrastructure in place, then I don’t see how you can reduce costs.

Now it turns out that this works beautifully with the systems that
people are building.  All I need Otonomous to do is create an API that
allows their system to record arbitrary corporate actionsm or for the
HKEX to build Phoenix which allows Hong Kong corporations to register
their liabilities.  At that point I just plug this in and *BOOM*, I
have an instant OTC commerical paper market.

== Automated settlement is *usually* a bad thing ==

When people talk about smart contracts they usually talk about systems
that automatically transfer funds in response to events, and the idea
is that if you have a situation were computers do everything,
everything becomes more efficient.  In fact, if computers do
everything, then things become a lot *LESS* efficient.

If you have a computer automatically move money, or automatically move
a large amount of money, then your costs in getting a system that is
error-free is astronomical, and once you have a system then it become
difficult to make any changes.  At that point you’ve blown any cost
savings you might have had.

Also, the smart contract technologies out there are set up to
encourage vendor lockin, which gets you both cost issues (i.e. once I
have my system on vendor X, they will jack up the prices) and
governence issues (once I have my system on vendor X, vendor X might
start telling me how to run my business).

== Privacy issues ==

One problem with blockchain is that right now there is no secure model
for private data.  The fact that the notes exist and that a company
has issued notes is something that small companies would really *want*
to make public.  However, then you run into the privacy of the note
holders, in which case you can deal with that by assigning the note
holders “code names” which are known only to the company or government
regulators.

One important part about these contracts is that if you don’t have to
publicize them.  You can have people agree to a contract, save it on a
USB flash drive, and no one has to know that it exists.

== So how do you litigate a smart contract? ==

One important rule is that if the technology becomes an issue in the case, you are doomed.

The important thing is not to confuse the judge.  You want to
everything look to the judge and opposing counsel as much as something
they are familiar with.  The risk that you have with weird
technologies is that often the person on the other side will claim
that he had no idea what he was signing and didn’t realize the
implications of the contract.  If you go to the judge, and show them
ethereum code and you have to have Ph.D. computer scientists explain
what the code does, then the judge would likely think “hey, I’m a
judge, I don’t understand what was going on, so it’s reasonable to say
that the opposing side didn’t understand what was going on.”  Even if
you have win in the end, the time and effort that you spend getting
expert witnesses will make it difficult for you to win.

When we went to court, we had police, lawyers, and judges that weren’t
computer people, and so we needed to make the contracts friendly to
them.  What we did was in our paper trial bundles, we included the
source code of the actual contracts.  We put the contract through the
viewer, and printed out a representation of the contracts on paper.
Then we did screenshots of how the contract would behave under certain
situations.

Now if the government felt that those screenshots and paper printouts
were not an accurate representation of the actual code, they could
have challenged this.  In fact, once they got the code, the formatted
contract, and a screenshot, they saw no need to challenge that we
presented a fair and accurate representation of the contract, and so
this part was not controversial at all.

Now if someone were to challenge that the evidence that we had was a
fair representation of the contract, at that point we could have
introduced the contract running on in a web browser for the judge to
interact with.  Also, if necessary we could have provided expert
witnesses that could testify as to the meaning of the code, and
because we are using a standard language, it would be easy and cheap
to find a “translator.”  The other thing that is important for
contracts, is what did the people involve understand to be the meaning
of the contract.

This matters in real world litigation.  Litigation strategy is often
about increasing time and expense to the other side so that they will
settle.  If you are dealing with new technology, you run the risk that
the other side will use the strategy of “confusing the issue” and
force you to increase your time and expense.

== What about regulation ==

OK, if you really want a discussion on regulation, then I can go
through the Banking Ordinance, the Securities and Futures Ordinance,
the Money Lending Ordinance.

First all this, you want this to be a tech problem, and not a
regulator problem.  So you imagine doing it with paper, and if you can
do it with paper, the regulations really don’t care if you do it with
computers.

So it turns out that debentures from Hong Kong companies are not
considered securities under the MLO.  As far as SFO regulations in
dealing with securities.  These are loans, and I’m a licensed money
lender.  If the SFC wants to regulate the issuance of commercial
loans, then I’ll have point them to the HKMA, the Hong Kong Police,
and the land barons, and while they spend the next three years arguing
about who has jurisdiction over what, I’ll just keep operating.

The other thing is that the notes are “regulator friendly.”  Under the
Reves test in the United States, they are resemble bank products and
so you can trade them among a small set of investors without
registration, and it’s not hard to deal with them through Regulation
CF.  In Hong Kong, it’s just a convertible note, so you use the
standard professional investor or private placement exemptions.

== So what about the terms of the convertible note? ==

The convertible note has specific terms that are designed for the
types of companies that exist in the Pearl River Delta.  Company wants
to manufacture gadgets, the factory doesn’t take credit, so the
company needs to raise cash in order to make the widgets.  This sort
of chicken-and-egg problem is quite common in trade finance.

The thing about Asia is that when people think startup, they think
“google”, however it turns out that most startup and SME’s are things
like local restaurants, garages, or “boring” small businesses.  In the
US, there is an efficient commercial paper and securitization market
to make it easy for these types of businesses to get capital.  In
Asia, there isn’t.

First of all its debt.  Debt has a lot of good advantages over equity.
First of all, it’s easy to value.  You calculate the likelihood that
the company will be able to repay.  Also, you end up with the market
determining the terms of payment.  In this specific case, you can’t
ask for more than a 10-12 percent coupon, because the company will say
no and find alternative sources of funding.  Because these are
IoT/gadget companies, if the company goes under, you still have the
stuff from the factory which you can resell to cover the losses.

The other thing is that it works if you have a company that doesn’t
need to be google.  Because its debt, you have an “automatic exit.”
If the company does really well, then it’s likely to end with a trade
sale.

The terms are also designed to be VC/trade sale friendly.  What you
don’t want as a VC is a cap table that consists of 50 investors each
with different conditions, because sorting everything out is a pain.
What we’ve done here is to create a standard set of conditions.  All
of the notes mature on 1 July 2018.  At that point, even though there
could be hundreds of investors, they all form one class on the cap
table, which makes it easy for the VC to figure out who gets what.

The interest rate conditions are also intended to create a commercial
paper market.  Once I have this set up, I will buy and sell these
notes from professional investors.  So on 23 May 2017, someone comes
up to me and buys a note, and I sell one to him.  On 30 June 2017,
someone comes to me and wants to sell the note.  I buy it from them.
In the meantime, I calculate the price based on the interest rate and
default risk, and it turns out that the holder can collect interest on
the note.

The other two terms that we changed is that most convertible notes
require the permission of the company to transfer, and we changed that
to a process of notification and non-objection.  Also there is a
binding arbitration clause, but we took out the confidentiality
clause.  If there is ever a dispute in the terms of the note, then it
makes sense to have a negotiation between the note holders acting as a
class and the company.

This also doesn’t give the note holders control rights unless
something goes wrong.  The point of this note is for passive investors
that provide working capital to the company, and to only take over
control if the company is failing.  The main point of the
non-objection clause is that the company founders would likely want to
maintain control of the company, and so the objection clause prevents
the notes for being used in a hostile takeover.

Also there are reasons why I’ve done 1-3 year maturity debt rather
than 7 year equity.  First of all, it’s a matter of cash management.
I have a fair chunk of my retirement funds in things that I would like
to be able to take out in 1-3 years, and if I leave it in a bank
account, I’m getting zero interest in it.

The thing is that if blockchain succeeds, then seven years from now
the securities markets will be so alien, that it’s hard to figure out
what they will look like or if IPO’s make sense.  The thing about an
IPO, is that the value of the IPO is that on the day after the IPO,
you can trade it with a ton of investors that couldn’t trade it the
day before, so there is a huge liquidity bump.  If blockchain
succeeds, then it means that there will be the ability to trade
securities at much earlier stages, which means that the liquidity bump
will be reduced.

One other thing is that Asia really doesn’t *have* an IPO market, and
there is no particular reason to think that the IPO mechanism will be
the way that Asian companies are funded.  If we are going to have to
build a new system, then I’m interested in the bigger system which is
the securitized loan and commercial paper markets.

== Tokenizing the contracts ==

You get into some interesting questions when you start talking about
tokenizing the contracts.  The thing about each note is that each note
is it’s one “thing” with a serial number and a trail of ownership.  It
doesn’t work at all like cash in a wallet, and one reason that we
didn’t do the “cash in the wallet” model is that then you end up
creating bearer instruments, and those are bad for two reasons.  First
of all, it gets all of the regulators upset, but more importantly,
most people who own companies wouldn’t feel comfortable oweing money
to anonymous people.

The other thing that we are working on is the question of how you
represent a “digital token.”  Bitcoin represents things as balances
and transactions.  You move 10 tokens from one wallet to another, and
then you add up all of transactions.  We didn’t go for that model,
because it didn’t seem to be what we needed.  Instead, each note is
its own digital “thing” with an ID number, and the purpose of the
blockchain is to record who is the registered owner of that “thing.”

== What next? ==

So the main thing is to talk to people to see what can be done with the tech.  It’s there for free so you can just use it for your own purposes.

So for me:

  • The big priority for me is to get some stable income.  I think I might have some sources on that, but the less I have to worry about paying my ridiculously high rent and school fees, the better off I am
  • I’m also spending a lot of time doing paperwork which I find annoying.  Right now, I’m spending a good chunk of my time trying to find an accountant that will audit my company and sign off on a balance sheet that is full of zeros, and trying to fill out forms to move my retirement money over so that I can invest that into small companies.  I might go out for a government grant, but honestly, the cost/benefit ratio is not worth it at this point.
  • I’m also trying to set up a coin based system for cash management.  Right now the Hong Kong banks are completely and totally hopeless, and I’ve given up on them.  The thing that’s necessary is to get the cash management function out of the HK banks, and you can possibly do that by creating USD or CNY depositary receipts off a bank in Qianhai.
  • Getting more contracts would be useful
  • Also trying to interface this tech to create a trading platform for convertible notes.
Leave a Comment

Leave a comment