On November 2, 2018, Uniswap was publicly announced and deployed to the Ethereum mainnet. In an exciting, anxiety-inducing moment I fired off the announcement tweets to my ~200 followers.
For many people, this was the first they heard of the project. For me it was the culmination of over a years worth of work — and a huge amount of help along the way.
Uniswap changed my life and today is its birthday. To celebrate this, I want to tell its story from the beginning in V0 of the Uniswap Birthday Blog series.
Stay tuned for V1 and V2 where I discuss Uniswap’s first year on Ethereum mainet and our plans for its future.
On July 6th, 2017 I was laid off from my first job out of college, working as a Mechanical Engineer at Siemens. Feeling down and directionless I informed my friend Karl Floersch, who at the time was working on Casper FFG at the Ethereum Foundation. The conversation went something like this:
Hayden: I just got laid off :(
Karl: Congratulations, this is the best thing that could have happened to you!!! Mechanical Engineering is a dying field. Ethereum is the future and you’re still early. Your new destiny is to write smart contracts!
Hayden: Don’t I need to like know how to code?
Karl: Not really, coding is easy. Nobody understands how to write smart contracts yet anyway. Ethereum, proof-of-stake, trustless computation, etc.
In order to expand my skillset, I decided it was time to work on a “real” project. At Karl’s suggestion I decided to implement an automated market maker, as described by Vitalik in this reddit post and this blogpost.
From October to November I built a proof-of-concept, including a smart contract and my very first website. The contract had a single liquidity provider and allowed simple swaps. Here it is in all its glory:
Disclosure — The demo remains unchanged from its original version, except for a single line of code
window.ethereum.enable()that I added to make it work with 2019 MetaMask.
Building the POC was my first step down the rabbit-hole of programmable money. It was the most intriguing thing I had worked on in my life. It didn’t even feel like work.
I also began to see the UX implications of automated market makers. At the time, EtherDelta was the only decentralized exchange with traction, but the UX felt messy and unintuitive. Using my demo somehow felt better.
In a talk at Devcon 3, Karl used my Uniswap demo as an example of the power of crypto-economics and open-source financial applications on Ethereum.
I had been unemployed for five months, living off cryptocurrency I was fortunate enough to have bought earlier in the year. Uniswap was a success by my only metric at the time — I knew how to write smart contracts. Maybe it was time to move on and get a job (if there were any jobs for Solidity-native developers).
However an attendee of Karl’s Devcon talk — Pascal Van Hecke — reached out to me. He had been closely following the progress of automated market makers on Ethereum and expressed interest in supporting my efforts. He even gave a grant to fund my next month of research. We began weekly calls to discuss progress.
Pascal brought new ideas to the table. More importantly, however, our calls brought a sense of structure and accountability to my work. Uniswap had two major unsolved problems which I set out to tackle with an engineering mindset:
It only worked for a single ETH/ERC20 pair
It only worked for a single liquidity provider
By this point I was fully captivated by Ethereum’s unbounded potential. These were the properties I cared about:
Yet something felt off in the ether. The major projects on Ethereum embodied some of its properties, but few embraced them fully. Central points of failure, censorable applications, and overly complex architecture. DAPPs were designed entirely around the idea of having a token for use cases that clearly did not need one.
I began thinking about Uniswap not just as a learning tool for myself — but one for others. I could not imagine a world where it competed with “real” projects. You know — the ones that raised between $20,000,000 and $150,000,000 in Summer 2017. But maybe it could serve as an example of an application that truly embodied Ethereum.
In December, I had attended an NYC Mesh meetup with Karl, following an anti-crypto article from its founder. Now Ethereum famous — Karl was recognized by a Coindesk reporter who asked him about the intersection between meshnets and crypto. Karl did not want to give an interview so he directed the reporter to me. I blathered on about Layer 2 solutions I barely understood, and was quoted in an article.
Callil Capuozzo, a friend from from elementary school through high school who I had not seen in ~6 years, saw the article and reached out. Since then he had worked as a designer at Microsoft, Google, and more recently had delved into Ethereum while working on a website for FOAM.
By late January 2018, all major smart contract issues had been solved. Exchange contracts could support multiple liquidity providers by using an internal liquidity token to track each LP’s share of generated fees and the underlying collateral. A factory contract allowed anyone to add support for a token. All tokens were paired with ETH allowing it to be used as an intermediary for anything-to-anything swaps in a single transaction.
I reconnected with Callil just after finishing the updated Uniswap smart contracts, and we discussed the project at length. He offered to help out with the frontend — which was now lagging behind the contracts. Working around his other projects, Callil designed and built a sleek new interface for Uniswap on top of my incredibly shitty React codebase.
Several weeks in it was pretty clear my react code was untenably bad. Fortunately, I had recently reconnected with a friend from college, Uciel Vilchis. Uciel was just coming out of a coding bootcamp (that he entered on the advice of our mutual Karl Floersch).
Looking to build up his resume and experience, Uciel agreed to refactor the Uniswap frontend codebase.
By March, 2018, the three of us had built a fully featured demo of Uniswap. Yes, of course I dug it up and hosted it. Here it is:
Disclosure — The demo remains unchanged from its original version, except for a single line of code
*window.ethereum.enable()*that I added to make it work with 2019 MetaMask.
By April 2018 I had been unemployed for 10 months. The crypto I was living off of was down over 75%, dramatically decreasing my personal runway. Despite this, I yolo-bought a last minute flight to Seoul, South Korea. This was the first time I left North America in my 24 years of life. Partially a personal trip, it was timed to coincide with Deconomy 2018.
I attempted to enter the conference without a ticket, but was firmly rejected. However, Karl was just arriving along with other members of the Ethereum foundation. Karl pulled me to the side, and introduced me to Vitalik, who he had already discussed Uniswap with in the past. Our conversation went something like this:
Karl: This is my friend Hayden, he made Uniswap!
Vitalik: Hi nice to meet you! Is it open source?
Me: Of course!
Vitalik: Whats the URL?
Vitalik: reads my entire smart contract on his phone
Vitalik: Have you considered writing it in Vyper? Also, you should apply for an Ethereum foundation grant.
Vitalik’s ideas had yet to fail me. Immediately after returning from Seoul, I spent two weeks re-writing the contracts in Vyper. There were no guides or developer tools like Solidity had, but I was able to use the original Casper FFG contract as a reference. At the time, this was the only Vyper contract I could find outside of simple examples in the core Vyper repo.
Up to this point Karl was my only close friend in the crypto world, but that was soon going to change. Just before leaving Karl invited me to a small social gathering. There I met and became friends with Philip Daian, Dan Robinson, and Andy Milenius. In addition to being wonderful people, all would become crucial to the success of Uniswap and influence its future direction.
Two weeks later, in May, I flew to Toronto for Edcon 2018. This was the first Ethereum conference where I made it past security. I spent 3 days attending talks, meeting people, and demoing Uniswap. My four friends in crypto were all there and introduced me to a ton of other people. My crypto social-network was expanding.
Among the friends I made at Edcon, Jinglan Wang deserves a shoutout as she has been a fantastic advisor ever since.
I met David Knott, a former Vyper dev, in person for the first time. I told him that I had re-written Uniswap in Vyper. The next morning at 8am I woke up to a phone call from him. He told me he was scheduled to give a talk on Vyper including a live demo in two hours. Uniswap was the only DAPP being written in Vyper, and he asked if I was interested in giving the talk instead.
I explained that I had only just learned Vyper two weeks prior, I had never spoken in public, and that I generally had no idea what I was doing. David assured me it was fine — two weeks building on Vyper was more than enough to speak publicly and authoritatively on it. So I gave my first talk:
I took the same flight back to NY as Dan. We spent the entire time gas-optimizing Uniswap. By the time the plane landed, Uniswap was 30% more efficient. It was now the most gas efficient exchange on Ethereum by a significant margin.
Edcon 2018 was extremely encouraging. The reactions to my Uniswap demo were more than just mild interest. People were legitimately excited by it. They seemed to understand and share the values I intended for it to be an example of. I realized Ethereum’s community went far beyond ICOs. There were people who truly cared about its vision of a permissionless, decentralized financial system.
My plane home from Edcon landed me directly in NYC Blockchain Week. I spent the next week attending an endless spew of events and parties. A tweet made its way onto my feed.
Are you dreading blockchain week?— Ric Burton 🇬🇧 ‣ 🇺🇸 (@ricburton) May 10, 2018
Are you waking up sweating at the prospect of being pitched a load of bullshit?
Are you behind on the projects that actually matter to you?
Are you desperate for a place to escape the mania and do some deep work?
Come along to #BUIDLWEEK 🎧💻 https://t.co/v5QSgXfKce
Living a 15 minute walk away, I decided to check it out.
Richard Burton was the founder of Balance, an Ethereum wallet startup. I showed him my demo, and he immediately wanted to understand how it worked. A long conversation ensued.
Up to this point, I considered my role in Uniswap to be mostly a technical one. When someone asked how it worked, I often started by telling them the mathematical formula behind it. Many people walked away confused.
Richard helped me understand that people not understanding Uniswap it was a me-problem, not a them-problem. Developers were just a small part of a bigger picture. If I wanted people to use my project, I needed to talk about it on their terms, in ways they understood. Uniswap’s biggest outstanding challenge was a social one.
It was around this time that I decided Uniswap was something I wanted to take to completion. I mapped out what was needed for a mainet launch.
Finalized, production-ready smart contracts
Responsive, user friendly trading interface
Smart contract security audit
My previously mentioned friend Phil is a blockchain security expert. On his advice (and with his introduction) I received a quote from Runtime Verification for a formalized model of Uniswap, a high level code review, and a partial formal verification of the smart contracts. Taking all this into consideration, I applied for an Ethereum Foundation grant of $50,000 + the quoted cost from RV.
Summer 2018 kicked off with me obsessively refactoring Uniswap’s smart contracts, working on the whitepaper, and attending crypto events in my spare time. For the next two months, I interviewed and then waited to hear back about the grant.
I worked daily at the Balance office, which Richard and the rest of the team members at Balance — Christian Baroni, Jin Ching, and Mike Demerais were kind enough to let me use. Knowing I was running low on funds, Richard was even generous enough to give me a personal grant to support my efforts.
I began attending weekly meetups called Whiteboard Wednesday at the Balance office. Every Wednesday for 2 hours anyone and everyone working on a crypto project was invited to share their weekly progress.
I attended almost every week, explaining and re-explaining Uniswap to different groups of people. I learned how to speak about Uniswap in different settings, and soon could explain it to almost anyone. I even started dipping my toes into crypto twitter.
Similar to my calls with Pascal, Whiteboard Wednesday brought a degree of accountability to my life. I did not want to show up two weeks in a row without progress to report.
As Summer progressed, I spent an increasing amount of time at the NYC MakerDAO office where my previously mentioned friend Andy was CTO. Maker is a decentralized stablecoin project that everyone reading this article already knows about so why am I even describing it. I became friends with a number of people at Maker including Ashleigh Schapp — another friend who would become important to Uniswap.
Working at both the Balance and Maker offices provided me with a constant stream of interesting people to meet and projects to learn about. Summer passed by quickly. My smart contracts were as optimized as I could make them on my own. Finally, towards the end of July I received an email. Uniswap would receive a grant from the Ethereum Foundation!
Grant in hand, I immediately contracted Runtime Verification to formalize and audit the contracts. In a series of calls with Daejun Park, Yi Zhang, and Xiaohong Cheng of RV, I detailed Uniswap’s mechanism and most important properties.
They began by creating a formalized model of Uniswap. Next, they they created a code spec, which re-worked math operations to minimize rounding error, and always favor liquidity providers over traders. The results of this work can be found here.
I modified the contracts to fit the spec. Next, RV performed a high level code review in which they recommended a number of a safety checks, fixes related to consistency, and other minor changes. A list of these improvements can be found here.
Finally, the Uniswap contract code was frozen and RV began work on formally verifying the contracts implementation matched desirable properties of the spec. This was the longest step of the process.
While the audit was on-going I hired Callil as a contractor to begin designing a production version of the Uniswap trading interface. The demo interface worked well, but felt too confusing for the finished product.
Uniswap had not yet been announced, but it was not entirely a secret either. In September I was invited to speak on a panel at ETHIS, a blockchain conference in Hong Kong. While technically not my first time speaking at a conference, it was the first time I was invited to do so!
In Hong Kong, I was able to catch up with Vitalik, who took a look at my finalized Uniswap’s code. He caught one error that even Runtime Verification had missed. I misspelled “recipient” as “recipeint” about 20 times.
I also accidentally stumbled my way into an Ethereum Foundation interview on ETH 2.0, and for the first time became the subject of a meme.
Here’s a blank template, if anyone else wants to try.
After Hong Kong, I spent 3 days at Shanghai Blockchain week on a pass-through Visa before returning to New York.
Back in New York I decided I would launch Uniswap in Prague at Devcon 4, if it was humanly possible. There were just 5 weeks to go — the busiest 5 weeks of my life.
With formal verification underway, the biggest outstanding task was implementing Callil’s latest frontend designs on top of a production ready codebase. I put out feelers for a contracting firm that could build this in a month, and was introduced to Dan Tsui, CEO at Kyokan. Thanks Rick Dudley for the intro!
The codebase was to be re-written almost entirely from scratch. I hired a contracting firm because I believed building a feature complete Uniswap frontend on such a short time frame to the standards I was hoping for required an entire team. Instead I got something better — Jacky Chan, VP of engineering at Kyokan.
As Jacky was coming in with almost no context on Uniswap, I wrote a long and detailed frontend spec to help speed along the process, while Callil provided highly detailed designs for every piece of the interface. In one month, Jacky built the Uniswap launch interface, almost entirely by himself. For a few smaller pieces, Kenny Tram of Kyokan jumped in to help.
About a week before Devcon, I finished the docs and the whitepaper. Also, the results of RVs formal verification work were in. No issues found! However, the Runtime Verification team expressed a concern. Uniswap had not been adequately studied for re-entrancy attacks, the issue behind the DAO hack. I reached out to Phil Daian for advice.
He was extremely busy preparing to present his latest research at Devcon 4, but nevertheless promised to look through the smart contracts for re-entrancy attacks before launch. Due to the last minute nature, this would of course be an internal audit — there would be no writeup and the results would not be made public.
In parallel to all of this I contracted Callil to design a shirt for the Uniswap to give out at the conference. I wanted the launch to be a moment. Something people could participate in. The shirt needed to be high quality — a shirt people would actually want to wear.
About a week before Devcon, in collaboration with his brother Leander, Callil put together this incredibly cool design:
To be finished on time, the shirts would have to be handmade through a process called silk screening. It would take almost a week to create the screen and about 8 hours to make the shirts.
I flew to Prague a day before the conference and began making sure all the pieces were in place. I checked in with Phil — he had reviewed most of the code but wanted to go over it again.
Callil bought a flight that landed on the first day of the conference to leave as much time for manufacturing as possible. He pulled an all nighter manufacturing shirts (along with Leander).
As soon as the shirts were finished he boxed them up, went straight to the airport and flew to Prague. He took a taxi from the airport directly to the conference center to hand them out with me.
Devcon was underway! I wandered the conference center handing out shirts, talking about Uniswap to anyone who listen to me, hinting the launch was happening soon.
In the afternoon, Callil and I met Jacky in person for the first time. After some socializing, we got to work fixing outstanding bugs adding UX improvements.
I spent half the second day wandering the conference and watching talks. In the afternoon, once more I got together with Jacky and Callil. We had a realization — Uniswap as a project should have a landing page separate from the trading interface. We built uniswap.io from scratch that day.
Finally, on the 3rd day of Devcon I heard back from Phil. As far as he could tell, there was no re-entrancy attacks that could be done on Uniswap exchange contracts, unless the token transfer function was specifically designed to allow re-entrancy into Uniswap.
This felt like an acceptable result — if a token was designed to attack Uniswap then the liquidity for that specific token could be stolen. All regular ERC20 tokens were safe from re-entrancy.
On November 2, 2018 — the final day of Devcon 4 — the smart contracts were deployed to the Ethereum mainet. Next, uniswap.io and app.uniswap.org/# were deployed. Finally, I reached out to anyone who had expressed interest in providing liquidity at launch.
About $30,000 was deposited into the contracts by a single provider, split across 3 tokens. This allowed for swaps of about $100. There was nothing else left to do.
I spent about an hour sitting alone on a bean bag, writing and re-writing the launch tweets. Fortunately, my friend Ashleigh walked by and helped review my tweets.
I clicked the button, nervous but excited for what the future would hold. What followed was a huge outpouring of support, ideas, and collaboration beyond my wildest expectation.
But that’s a story for V1, the next blogpost in this series :)
Vitalik did. I was originally going to call it Unipeg — a mixture between a Unicorn and a Pegasus.
When Karl first told Vitalik about the project he said:
Alan Lu of Gnosis was the very first person to conceive of x*y=k market makers on Ethereum
Martin Koppleman of Gnosis told Vitalik about the idea.
Vitalik saw its potential and began posting about it publicly. On his website:
and in the comments of this article written by Phil Daian:
I created Uniswap, the specific implementation of an x*y=k market maker that exists on Ethereum today.Thanks to Jinglan Wang.