<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>以人为本</title>
    <description>Core developer of Mixin Network. Passionate about security and privacy. Strive to formulate elegant code, simple design and friendly machine.</description>
    <link>https://ren.ceo</link>
    <atom:link href="https://ren.ceo/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Sat, 08 Mar 2025 20:15:00 +0000</pubDate>
    <lastBuildDate>Sat, 08 Mar 2025 20:15:00 +0000</lastBuildDate>
    <generator>Jekyll v4.1.1</generator>
    
      <item>
        <title>Medium is a Reading Disaster</title>
        <description>&lt;p&gt;Medium was launched in 2012, and was once an extraordinary reading experience, for its large quantity of excellent publishers and fast yet clean reading interface. However, over the years, Medium turns to be a worse alternative compared to which it tried to rival, not to say some new players, e.g. Substack.&lt;/p&gt;

&lt;p&gt;From and clean reading experience to a disaster, two strategies of Medium should be most blamed. One is on technology side, the intensive modern Web technology has made Medium slower. To read a single post, the browser needs to send out more than 100 requests, and downloads about 3MB resources, while the main content is no more than 100KB.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ren.ceo/images/2021/01/06/medium.png&quot; alt=&quot;Medium&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In these huge load of resources, most doesn’t contribute to actual reading experience. Some makes bothersome animations, when scrolling through the post,  animations really make it harder to concentrate on the content. Others are tracking the visitors and making irrelevant writer and article recommendations, thus leads to the other strategy of Medium, social publishing and reading.&lt;/p&gt;

&lt;p&gt;Medium randomly shows full screen overlay, like traditional paywall news website, to make you register an account before reading a post shared by someone. Although it’s easy for a developer to strip this popup parameter from the URL, most normal readers can’t dismiss this overlay in the page directly. And if you have a Google account logged in the browser, then Medium prefers to make you sign in with your Google account by showing a small popup, better than that overlay. By doing so, Medium tries its best to disturb readers and to track them. Anonymous third party trackers along with personal tracking through registered accounts make Medium easier to monetize on you, just like how Facebook or Google abuses your privacy. Not only they can recommend articles to you, they can also recommend ads by selling your privacy. When everyone had its own blog, readers were able to read without hassles, instead of being exposed to shit.&lt;/p&gt;

&lt;p&gt;Besides huge load of resources, bothersome animations, and endless tracking, Medium also offers the worst comments feature. When you want to read how people respond to an article, you need to click that responses button to open a new page, and if some response is not short enough, it would be stripped and you need to open another new page to read that. You just can’t stay in the same page to read the responses flawlessly. I don’t understand how does this contribute to Medium in user experience or revenue.&lt;/p&gt;

&lt;p&gt;Due to the strategy of Medium, it should be used as something similar to Facebook or Twitter to spread your article. But never make it the main place to publish something, you should always have some good reading experience to serve your readers, not this disaster.&lt;/p&gt;
</description>
        <pubDate>Wed, 06 Jan 2021 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/medium-is-a-reading-disaster</link>
        <guid isPermaLink="true">https://ren.ceo/posts/medium-is-a-reading-disaster</guid>
        
        
      </item>
    
      <item>
        <title>2020</title>
        <description>&lt;p&gt;Most suffered badly in 2020 and they name it their worst year ever. For me, on the contrast, 2020 is my best year of lifetime. COVID-19 is no doubt the most blamed factor that drove the economy down. That’s not the case for me.&lt;/p&gt;

&lt;p&gt;Personally I stay in my apartment at most time without social activities as my lifestyle for years, and am less travelled. So COVID-19 makes no harms on my daily life and surprisingly makes it even better, e.g. less crowed supermarkets. Though the constantly healthy code checking or temperature measuring actually annoys me, but wearing masks as a new norm has made my privacy protected in a country under strictest surveillance with cameras in every corner.&lt;/p&gt;

&lt;p&gt;On the side of working, we are a small team, an Internet native team. Before 2020, we already communicated and collaborated mostly online,  with Slack and GitHub, and we rarely made face-to-face communications or meetings. At the end of 2019, we also made the decision to close our only office in Beijing and went fully remote, that was before COVID-19 was reported and aware by people. Not only our internal communication, but also all our external cooperations are online. So COVID-19 has almost zero impacts on our business. Another crucial advantage that protects our business from pandemic is that we are still in an early stage without pressure on revenue.&lt;/p&gt;

&lt;p&gt;Without negative impacts from pandemic, 2020 is just a normal year for me. Every year, I feel dramatically improved, the same in 2020. Most significant achievements are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Better understanding in cryptographic theory and technology. I have read lots of papers on elliptic curves, BLS digital signature, group theory, and reviewed many mathematical knowledge from my college.&lt;/li&gt;
  &lt;li&gt;Lots of work in distributed system. Most of my engineering works are making something distributed. The Mixin Kernel is a distributed ledger, the D3M-PIN system is a distributed authentication system for human, and the Mixin Domain assures its assets security by distributed threshold signature.&lt;/li&gt;
  &lt;li&gt;Further learning on WebRTC technology. My previous startup is an video streaming service, and I have had good experiences with many streaming technologies including WebRTC, which was not mature enough 5 years ago. This year we added E2EE group voice call in Mixin Messenger, and I choose WebRTC as the foundation, and made our own SFU, Kraken.&lt;/li&gt;
  &lt;li&gt;More fluent English skills. By reading more papers and news, I have improved a lot in understanding English. I have also restarted my writing and created about 100 posts. As a skill, English and programming are the only that I feel improved after leaving college. Yesterday I read some IELTS articles and just felt much easier than my daily readings.&lt;/li&gt;
  &lt;li&gt;Significant growth of our startup. After three years development, Mixin has gained lots of users and is managing hundreds of millions of assets in the distributed ledger. During the pandemic year, we make the core metrics tripled than 2019. Thus result has built a solid starting point for our next 10 years.&lt;/li&gt;
  &lt;li&gt;Leap understanding on investments and finance. I rarely do financial investments and resist doing pure financial things. After working on the public distributed ledger for years, the technology side of a financial system, I have changed my minds a lot on finance. Regular investing is actually the same methodology I insist on everything, and making money with money is not a shame. We also jointly started some MTG projects by providing money for liquidity, including an AMM and a stablecoin.&lt;/li&gt;
  &lt;li&gt;More thorough and softer thoughts on human. I am a sharp one on things, and I judge critically, not for benefiting from that, but for improving others. And I do really bad on distinguishing one from the other on their capabilities, I believe people are equal, this is also the root cause of my critical attitudes towards people. Both of them have been somewhat overcome.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are still more to list, but the most significant achievement I made in 2020 is staying the same me as the one of my high school. I think about myself a lot, during breaks, before sleeping, and when impressed by something, and I always have a conclusion that I have never changed since high school. During an event on Dec 20, someone pointed out that it was not high school, it was only that I realized myself in high school, people was born like. I make no further thinking on this topic, but I know I’m the same high school boy, defined by my motive, my belief in slow is fast, in consistence.&lt;/p&gt;

&lt;p&gt;Just as my previous post, almost all my posts lead to the same summary that consistence makes great difference, the consistent me has make every year better than the past years for me. Thus I can forecast 2021 would surpass 2020 to be my best year of lifetime.&lt;/p&gt;
</description>
        <pubDate>Fri, 01 Jan 2021 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/2020</link>
        <guid isPermaLink="true">https://ren.ceo/posts/2020</guid>
        
        
      </item>
    
      <item>
        <title>Motive</title>
        <description>&lt;p&gt;For most people, it’s hard to do anything. There are always obstacles, from daily jobs to life decisions. They fears everything, if I did this wrong I would lose the job, if I lost the job I would not find the way to make my life. The same tough feelings also apply to startup founders, they are afraid of failures, of not being able to attract customers, of failing to satisfy investors,  of being copied by Google or Facebook. They usually give up very soon.&lt;/p&gt;

&lt;p&gt;In contrast, there are a few people who fears nothing and are always passionate about what they do. Along with the anticipating IPO of Airbnb, Paul Graham wrote a nice post about its founders, praising their earnestness. They never give up, even when none likes their idea, neither the investor nor the user. With zero growth, they are still full of energy that it was impossible not to like them.&lt;/p&gt;

&lt;p&gt;The difference between these two kind of people is not that simple, not obvious but huge. Those hard people fears everything because the imagined obstacles, they imagine losing job after they made some changes so they lose the opportunity of improvements, they imagine a large varieties of failures so they don’t found any startups or give up their business sooner than anyone else. However the other kind of people are even not aware of all the obvious obstacles that almost everyone can see. Like the Airbnb founders, full of energy when it’s obvious that none likes their idea. They even did this for almost 2 years all on their credit cards.&lt;/p&gt;

&lt;p&gt;They have fully maxed-out their credit cards for more than a year, lost money and time, they saw people around them made great and quick IPO, they were told by investors that another idea would make them rich like rocket. They didn’t give up. Paul believes one clear reason is that they weren’t doing this just for the money. It’s the motive, the nature of the founders.&lt;/p&gt;

&lt;p&gt;I have written about my thoughts on investment and on building a company, the metaphor is simplicity and consistent, to do a simple thing for a long term.&lt;/p&gt;

&lt;p&gt;On investment, it’s betting on the things you believe in and believe in it for decades, ignore all news and signals, ready to lose all so that you can believe in it, believe in it so that you are ready to lose all. I don’t do serious investments at all, just Tesla, Snap, Bitcoin and Monero, all of them are the products I love from the very beginning. I put money in them not for money, never for money, for the belief in something. I believe in and love the future of electric energy, I love how Tesla and Snap make uncountable innovations. I believe in and love the freedom of Bitcoin and Monero are offering. I put money in my belief, not for money. I know I won’t lose and ready to lose all, for decades.&lt;/p&gt;

&lt;p&gt;On building a company, it’s doing the things you believe in and are willing to spend 200 percent of your time and money on making them. My passion on the freedom, privacy and security of messaging and money, has driven me to make Mixin, now it’s already 3 years. I have never had any moment of feeling tired or giving up. I’m always excited on the future I am building. Only thus, I can do such a simple product for years, without adding any new features, all work is on making the current feature set better and better. Otherwise, I would become a normal founder who was a master at adding features and pivoting. It’s my motive on building a company that makes me believe in simplicity is fast, and slowness is fast.&lt;/p&gt;

&lt;p&gt;Everyone has a motive to do things, most people do investment to make money, do startup to make money. They may succeed. But my motive is always my belief in the things, no doubt, ever.&lt;/p&gt;
</description>
        <pubDate>Sun, 13 Dec 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/motive</link>
        <guid isPermaLink="true">https://ren.ceo/posts/motive</guid>
        
        
      </item>
    
      <item>
        <title>Create Professional PDF with Markdown and Firefox</title>
        <description>&lt;p&gt;When I decided to write technical specifications for Mixin Kernel, I finally picked Jekyll and &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;K&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;KaTeX&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.6833em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07153em;&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.13889em;&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07847em;&quot;&gt;X&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; as my writing tools. They create beautiful and portable pages for viewing in browser, but sometimes a PDF file is still good for better transferring or offline reading, e.g. in email attachment or Kindle, and I’m amazed that Firefox is capable of exporting my pages to a professional PDF. I am able to produce beautiful HTML in tandem with professional PDF.&lt;/p&gt;

&lt;h2 id=&quot;stylesheet-for-printer&quot;&gt;Stylesheet for Printer&lt;/h2&gt;

&lt;p&gt;The core idea is to use the print to file feature of Firefox, which retains all the page style defined by the CSS stylesheet. And a good feature of CSS is that it allows different rules for different medias, i.e. you can define page style for displaying in computer screen, mobile screen or even for printing.&lt;/p&gt;

&lt;p&gt;My blog interface is very simple, I’m able to do very little changes to make a professional PDF style.&lt;/p&gt;

&lt;div class=&quot;language-scss highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;@media&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;only&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;.layout.header&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;nc&quot;&gt;.layout.container&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;nc&quot;&gt;.post.block&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;border&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;padding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;margin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;font-size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;.9em&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The CSS above removes all my blog header and tweaks some margin and padding for the main content.&lt;/p&gt;

&lt;h2 id=&quot;print-to-file&quot;&gt;Print to File&lt;/h2&gt;

&lt;p&gt;Bring the advanced Print dialog out from the Firefox context menu, instead of using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ctrl+P&lt;/code&gt; shortcut. Then in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Page Setup...&lt;/code&gt;, do basic paper size modifications, I changes nothing but choosing the A5 paper size, and apply the modifications.&lt;/p&gt;

&lt;p&gt;Now click &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Print...&lt;/code&gt; to make extra page settings, I do nothing. But a weird thing is that in this simple Print dialog, there is another paper size option, which doesn’t inherit my previous modification, but the final result is still produced as my previous settings.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ren.ceo/images/2020/11/21/kernel-paper.png&quot; alt=&quot;kernel paper&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Good.&lt;/p&gt;
</description>
        <pubDate>Sat, 21 Nov 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/create-professional-pdf-with-markdown-and-firefox</link>
        <guid isPermaLink="true">https://ren.ceo/posts/create-professional-pdf-with-markdown-and-firefox</guid>
        
        
      </item>
    
      <item>
        <title>Rolling Indie Grant</title>
        <description>&lt;p&gt;I love open source, I use open source products every day, I also publish lots of open source code, and I donate to open source projects sometimes. Actually I want to donate to open source projects more often, because as an open source developer I know the difficulties these open source maintainers face, without enough direct financial pay back from their excellent projects, they are often unable to make fast or even regular improvements, so that many good projects are abandoned.&lt;/p&gt;

&lt;p&gt;I’m one of those few lucky open source developers who have made millions from building open source projects. Lucky and busy, that’s why I only donate to open source projects seldomly. But I always know nothing could be used as an excuse to not contribute back, and I also believe any tiny contributions are better than none, so I’m going to make a rolling indie grant project.&lt;/p&gt;

&lt;p&gt;The grant rule is simple, regularly donate to those active indie projects whose financial condition are bad. Precisely executed as:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Build a rolling grant pool of maximum $1M in crypto.&lt;/li&gt;
  &lt;li&gt;Select active indie projects which the pool owners used regularly.&lt;/li&gt;
  &lt;li&gt;Grant $10K to each project, with 6 months rolling payment.&lt;/li&gt;
  &lt;li&gt;Grant may be stopped due to inactive development.&lt;/li&gt;
  &lt;li&gt;After grant finishes, decide further grant based on pool size and project status.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This grant pool starts from my own fund, and accept contributions from who love open source. Here open source is not restricted to traditional open source code, I think writings, drawings, musics, movies, and services that value privacy are all some kind of open source, they don’t even need to be free or open their code or copyright.  It makes us able to keep track of the project status without extra efforts by limiting the projects to those the pool owners used regularly.&lt;/p&gt;

&lt;p&gt;The grant won’t get any shares from the project, but the project is required to be not in good financial situation. That’s because the grant pool is not large, and meant for those projects which most need it.&lt;/p&gt;

&lt;p&gt;Roll the grant!&lt;/p&gt;
</description>
        <pubDate>Mon, 19 Oct 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/rolling-indie-grant</link>
        <guid isPermaLink="true">https://ren.ceo/posts/rolling-indie-grant</guid>
        
        
      </item>
    
      <item>
        <title>Math in Jekyll with KaTeX</title>
        <description>&lt;p&gt;I have spent days on reading papers related to Byzantine fault tolerant systems, learnt a lot of course, and they also drive me to write about the technical details on how Mixin achieves novel performance on a specific BFT problem, i.e. a directed acyclic graph with almost instant finalizations on simple UTXO transactions.&lt;/p&gt;

&lt;p&gt;First of the first is to choose a proper paper writing tool. Most papers use &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;L&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;LaTeX&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.6833em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;L&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.13889em;&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07847em;&quot;&gt;X&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; to produce typical two column documents, mostly in PDF. I guess the two column tradition for essays is the limited space in printed journals. Journals are printed in very large paper size compared to novels, and to save space they also use smaller font size, so two column will make lines shorter, more readable.&lt;/p&gt;

&lt;p&gt;However in a digital and mobile world, I believe a one column paper makes better reading experience in portable devices, and even in computer we have infinite space to display the article, larger font size and one column are possible now. So I decide to produce the final document in HTML, and render formulas with &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;K&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;KaTeX&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.6833em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07153em;&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.13889em;&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07847em;&quot;&gt;X&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; engine.&lt;/p&gt;

&lt;p&gt;My blog is built with Jekyll, the original writing is Markdown, rendered with kramdown. It’s pretty easy to enable &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;K&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;KaTeX&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.6833em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07153em;&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.13889em;&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07847em;&quot;&gt;X&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; server rendering along with kramdown. At first download a proper release (0.11.1) of &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;K&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mi&gt;T&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mi&gt;X&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;KaTeX&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.6833em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07153em;&quot;&gt;K&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.13889em;&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.07847em;&quot;&gt;X&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;, then extract the files in the Jekyll project.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;ls &lt;/span&gt;_assets/vendor/katex/
fonts  katex.scss
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As the above shown, I only keep the fonts directory, and rename the katex.css file to katex.scss. Then modify all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;url&lt;/code&gt; references to the SASS &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;asset-url&lt;/code&gt; format.&lt;/p&gt;

&lt;div class=&quot;language-sass highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;sx&quot;&gt;url(fonts/KaTeX_AMS-Regular.woff2)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;woff2&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;+  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;asset-url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;./fonts/KaTeX_AMS-Regular.woff2&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;woff2&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Next is to modify the application.scss to import katex.scss.&lt;/p&gt;

&lt;div class=&quot;language-sass highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;//= require katex/katex&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then modify the Gemfile and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bundle install&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;kramdown-math-katex&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally modify _config.yml.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;kramdown&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;math_engine&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;katex&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$$1 + 1 = 2$$&lt;/code&gt; produces &lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;1 + 1 = 2&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.7278em;vertical-align:-0.0833em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mbin&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2222em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.6444em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2778em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.6444em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;, and&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$$f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi$$
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Produces&lt;/p&gt;

&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot; display=&quot;block&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;msubsup&gt;&lt;mo&gt;∫&lt;/mo&gt;&lt;mrow&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;∞&lt;/mi&gt;&lt;/mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;∞&lt;/mi&gt;&lt;/msubsup&gt;&lt;mover accent=&quot;true&quot;&gt;&lt;mi&gt;f&lt;/mi&gt;&lt;mo&gt;^&lt;/mo&gt;&lt;/mover&gt;&lt;mo stretchy=&quot;false&quot;&gt;(&lt;/mo&gt;&lt;mi&gt;ξ&lt;/mi&gt;&lt;mo stretchy=&quot;false&quot;&gt;)&lt;/mo&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;msup&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;mrow&gt;&lt;mn&gt;2&lt;/mn&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mi&gt;i&lt;/mi&gt;&lt;mi&gt;ξ&lt;/mi&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;/msup&gt;&lt;mtext&gt; &lt;/mtext&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;mi&gt;ξ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;f(x) = \int_{-\infty}^\infty \hat f(\xi)\,e^{2 \pi i \xi x} \,d\xi&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:1em;vertical-align:-0.25em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.10764em;&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;mopen&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;mclose&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2778em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:2.3846em;vertical-align:-0.9703em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mop&quot;&gt;&lt;span class=&quot;mop op-symbol large-op&quot; style=&quot;margin-right:0.44445em;position:relative;top:-0.0011em;&quot;&gt;∫&lt;/span&gt;&lt;span class=&quot;msupsub&quot;&gt;&lt;span class=&quot;vlist-t vlist-t2&quot;&gt;&lt;span class=&quot;vlist-r&quot;&gt;&lt;span class=&quot;vlist&quot; style=&quot;height:1.4143em;&quot;&gt;&lt;span style=&quot;top:-1.7881em;margin-left:-0.4445em;margin-right:0.05em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:2.7em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sizing reset-size6 size3 mtight&quot;&gt;&lt;span class=&quot;mord mtight&quot;&gt;&lt;span class=&quot;mord mtight&quot;&gt;−&lt;/span&gt;&lt;span class=&quot;mord mtight&quot;&gt;∞&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;top:-3.8129em;margin-right:0.05em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:2.7em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sizing reset-size6 size3 mtight&quot;&gt;&lt;span class=&quot;mord mtight&quot;&gt;∞&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;vlist-s&quot;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;vlist-r&quot;&gt;&lt;span class=&quot;vlist&quot; style=&quot;height:0.9703em;&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.1667em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord accent&quot;&gt;&lt;span class=&quot;vlist-t vlist-t2&quot;&gt;&lt;span class=&quot;vlist-r&quot;&gt;&lt;span class=&quot;vlist&quot; style=&quot;height:0.9579em;&quot;&gt;&lt;span style=&quot;top:-3em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:3em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.10764em;&quot;&gt;f&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;top:-3.2634em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:3em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;accent-body&quot; style=&quot;left:-0.0833em;&quot;&gt;&lt;span class=&quot;mord&quot;&gt;^&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;vlist-s&quot;&gt;​&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;vlist-r&quot;&gt;&lt;span class=&quot;vlist&quot; style=&quot;height:0.1944em;&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mopen&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.04601em;&quot;&gt;ξ&lt;/span&gt;&lt;span class=&quot;mclose&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.1667em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;e&lt;/span&gt;&lt;span class=&quot;msupsub&quot;&gt;&lt;span class=&quot;vlist-t&quot;&gt;&lt;span class=&quot;vlist-r&quot;&gt;&lt;span class=&quot;vlist&quot; style=&quot;height:0.8991em;&quot;&gt;&lt;span style=&quot;top:-3.113em;margin-right:0.05em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:2.7em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sizing reset-size6 size3 mtight&quot;&gt;&lt;span class=&quot;mord mtight&quot;&gt;&lt;span class=&quot;mord mtight&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;mord mathnormal mtight&quot;&gt;πi&lt;/span&gt;&lt;span class=&quot;mord mathnormal mtight&quot; style=&quot;margin-right:0.04601em;&quot;&gt;ξ&lt;/span&gt;&lt;span class=&quot;mord mathnormal mtight&quot;&gt;x&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.1667em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;mord mathnormal&quot; style=&quot;margin-right:0.04601em;&quot;&gt;ξ&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

&lt;p&gt;&lt;em&gt;References&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://gendignoux.com/blog/2020/05/23/katex.html&quot;&gt;How I blog about math: an update on KaTeX with Jekyll&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/KaTeX/KaTeX/releases&quot;&gt;KaTeX releases&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</description>
        <pubDate>Mon, 12 Oct 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/math-in-jekyll-with-katex</link>
        <guid isPermaLink="true">https://ren.ceo/posts/math-in-jekyll-with-katex</guid>
        
        
      </item>
    
      <item>
        <title>Return of Different Uniswap Fee Distribution Models</title>
        <description>&lt;p&gt;DeFi is hot for awhile, the significant star of DeFi is Uniswap without doubt. But automated market maker is not a new thing, Bancor was born years earlier than Uniswap, yet not gains enough usage despite its famous ICO. We are not able to get the answer why Uniswap succeeds so much than Bancor, but I believe Uniswap is almost the simplest yet most powerful AMM solution over the years.&lt;/p&gt;

&lt;p&gt;Despite its huge success, I’m still trying to figure out potential improvements on the simple constant product formula used by Uniswap. Last night I was drinking some beer with friends and they inspired me that the core difference between Uniswap and traditional centralized exchanges is not order book, it is the fee distribution mechanism. A traditional exchange deduces the fee from every trade, and the fee is hold by the exchange itself, and they rare puts the fee into the order book. Uniswap also charges the fee from every trade, however Uniswap puts the charged fee into the liquidity pool instead of holds it in a separate pool.&lt;/p&gt;

&lt;p&gt;May this small difference make great impact? I have tried to make a mathematic model to predict the potential impact, but too complicated for me to make it in a short time. So I wrote some program to do many return simulations on different Uniswap fee distribution models.&lt;/p&gt;

&lt;p&gt;My simulation code is very simple, it first defines the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swap&lt;/code&gt; engine with different &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Trade&lt;/code&gt; logic based on the fee distribution models. Then simulate batch of trades, where positive number means swap &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y&lt;/code&gt;, and negative vice verse. The simulation also assumes static liquidity pool without any addition or reduction besides the fee.&lt;/p&gt;

&lt;div class=&quot;language-golang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Swap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Simulate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;trades&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;verbose&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;float64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;trades&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Trade&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

	&lt;span class=&quot;n&quot;&gt;dX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IX&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;dY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;IY&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;verbose&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;X: %f %f%%&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Y: %f %f%%&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dY&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dY&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Simulate&lt;/code&gt; function produces the changes of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y&lt;/code&gt; as result, i.e. the outcome of providing two assets &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y&lt;/code&gt; as liquidity in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swap&lt;/code&gt; engine. One simulation uses 10,000 trades, and I pass 1,000 these trades groups to two fresh swap engines, one engine with the original Uniswap fee distribution model, while the other with another separate fee model.&lt;/p&gt;

&lt;div class=&quot;language-golang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Benchmark&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;float64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tradesGroup&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[][]&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;float64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;winX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;winY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;winXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;failXY&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;int&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;trades&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;tradesGroup&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NewSwap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;FeeModelOriginal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;ss&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NewSwap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;osdX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osdY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Simulate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;trades&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;ssdX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ssdY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ss&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Simulate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;trades&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ssdX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osdX&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;winX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ssdY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osdY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;winY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ssdX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osdX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ssdY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osdY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;winXY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ssdX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osdX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ssdY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;osdY&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
			&lt;span class=&quot;n&quot;&gt;failXY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
		&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Printf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;X WIN: %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;Y WIN: %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;X Y WIN: %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;X Y FAIL: %d&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;winX&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;winY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;winXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;failXY&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I produces some data set with different behaviors, and run the benchmark.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;All random trades, but with a threshold to limit the trade size, e.g. I generate some random numbers, but they never exceed 1/100 of the pool size. Benchmark shows that the two fee separate model wins in both X and Y returns, and the larger the threshold, the better they perform. A bonus is that all these simulations produce positive returns.&lt;/li&gt;
  &lt;li&gt;Random round-robin trades, and with a threshold to limit the trade size, e.g. I generate a random positive number, follows a random negative number, again and gain, but they never exceed 1/100 of the pool size. The result is very similar to all random trades.&lt;/li&gt;
  &lt;li&gt;Monotonic increased price, and with a threshold to limit the trade size, e.g. I generate all negative numbers, that means people keep swapping Y to X. Simply separate the fee with the liquidity pool performs worse than the original Uniswap model, all fails. But if I make trade at first, then charge the fee and separate the fee pool, it wins all simulations.&lt;/li&gt;
  &lt;li&gt;Strictly static prices, and with a threshold to limit the trade size, e.g. I swap some random amount of X to some Y, then I swap these Y immediately back to X, again and gain. Both two fee separate models win all the simulations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These rough simulations show that separating the fee pool with the liquidity pool will increase return on providing liquidity to Uniswap. Full code is on my &lt;a href=&quot;https://github.com/cedricfung/uniswap-return-simulation&quot;&gt;GitHub&lt;/a&gt;, run the code to get full report.&lt;/p&gt;
</description>
        <pubDate>Sun, 11 Oct 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/return-of-different-uniswap-fee-distribution-models</link>
        <guid isPermaLink="true">https://ren.ceo/posts/return-of-different-uniswap-fee-distribution-models</guid>
        
        
      </item>
    
      <item>
        <title>Anti Security Movement</title>
        <description>&lt;p&gt;That normal night after yet another Apple special (dull) event, our team sit in the office, the keyboards buzzed and we were working on some security features to better protect the privacy. Then someone in a group chat announced excitedly that my app was marked as a virus in their Samsung Galaxy phone,  followed by more members reported that their smartphones reported the similar things, to name a few, Huawei, OPPO, and Smartisan.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://ren.ceo/images/2020/09/16/virus.jpg&quot; alt=&quot;virus&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Mmhmm, I thought, finally we were treated as an insecure company, because a typical virus in a Chinese smartphone generally represented some serious characters.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;All projects developed and released open source.&lt;/li&gt;
  &lt;li&gt;Full end-to-end-encryption for better privacy and anti censorship.&lt;/li&gt;
  &lt;li&gt;Cryptocurrency for decentralized money ownership.&lt;/li&gt;
  &lt;li&gt;Pay nothing to the security surveillance.&lt;/li&gt;
  &lt;li&gt;A good application name which doesn’t sound like shit.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Of course, I whispered to myself, we had these in our app, they made the correct judgment. I made some complaints in the group chat like why they didn’t recognize us earlier, anyway finally the justice came, I wanna eat something, whenever I thought about some celebrations, I ate. Frustrating we had emptied our fridge, only an onion, I could not wait for the food delivery, and I was not even allowed to use the Meituan app because whenever I opened the app the smartphone would warn me that I had a virus app, please uninstalled it at first, surely I couldn’t, it’s a virus, my own virus. So I ate the onion, thought and was moved that I need to do something.&lt;/p&gt;

&lt;p&gt;I was a programmer, or a nerd, I was still not able to believe that I could became some activist who started the famous and world wide Anti Security Movement. Since then, all viruses have united to fight against the security surveillance.&lt;/p&gt;

&lt;p&gt;That night, before I was finally and officially recognized as a virus, I was already prepared to do something, it was the time to take action. Everybody was under extreme surveillance at anytime and anywhere, there were countless cameras, no matter on the streets or in the buildings,  and guess what, inside our rooms, we had way more cameras, from Amazon, Apple, or Tencent, further more, we had trackers inside our smartphones and bodies. None was capable of changing this, we viruses were the last hope of this society.&lt;/p&gt;

&lt;p&gt;I sued Tencent at the first time. After those giant smartphone vendors, stand the true giant, Tencent, it was controlled by the government to monitor every electric devices. So I sued Tencent for preventing innocent people from using my virus. I knew it was impossible for me to won these kind of lawsuits, who would let a virus won after all. Many fake viruses would not file a lawsuit, they only submitted several complaints to Tencent. I was true, I didn’t act, I cared about the people, they needed viruses to fight against surveillance.&lt;/p&gt;

&lt;p&gt;I lost the case, very fast. I already knew that, who knew Tencent monitored the court or the court controlled Tencent, but they were definitely one. I still believed there were many true viruses, I must unite them together to take the fight. I made the antisecuritymovement.org website at first, because that was my best skill. Then I posted that to several niche end-to-end encrypted forums, and those forums were homes to viruses, both true and fake ones. Soon I received messages from many virus apps, among them including WhatsApp and Telegram. Though I already knew I could get support but I was still shocked to receive messages so quickly.&lt;/p&gt;

&lt;p&gt;WhatsApp and Telegram were true viruses, they all had the same 5 serious characters as my app. WhatsApp was once not a true virus, but after the TikTok case between ByteDance and Trump, lots had changed, WhatsApp was open source. Years later, the Great Firewall of China was pulled down, and all apps were allowed in China by the government, the huge market blew down the leading America technology industry. China ruled the world with its leading AI technology, provided by Tencent, all under surveillance, including the heads of other countries, nobody knew whether the Chinese president was controlled by Tencent at all.&lt;/p&gt;

&lt;p&gt;There were some other notable true viruses joined us, an interesting one was Archie McPhee, their cute tardigrade products were all blocked by PayPal from transactions due to the stupid OFAC sanctions list. In Dec 2019, US Dept of Treasury sanctioned companies linked to Serbian arms dealer Slobodan Tesic, including Cyprus-based Tardigrade Ltd. PayPal learnt the old skills deprecated by China government already, after all it was a developing company in a developing country. Anyway, we were united to start the Anti Security Movement. A long journey began.&lt;/p&gt;

&lt;p&gt;The whole part after around I began eat the onion is written by GPT-3, because the tears were endless. I guess the Onion must have mastered this kind of neuron network far early than those hard working machine learning scientists. Who knows GPT-3 can’t foresee the future?&lt;/p&gt;
</description>
        <pubDate>Wed, 16 Sep 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/anti-security-movement</link>
        <guid isPermaLink="true">https://ren.ceo/posts/anti-security-movement</guid>
        
        
      </item>
    
      <item>
        <title>Mixin Trusted Group</title>
        <description>&lt;p&gt;Mixin Kernel is a badly simple distributed ledger which handles only basic UTXO transactions, no smart or stupid contracts, not even scripts complicated as Bitcoin. This simplicity makes Mixin Kernel the fastest decentralized solution for transferring digital assets. In the original whitepaper we proposed the Domain Extensions to make trusted computation possible for Mixin Network, now two years later, with the experience in building trusted financial systems, I have another proposal, a multisig group.&lt;/p&gt;

&lt;p&gt;I prefer to call it Mixin Trusted Group or MTG. The old Domain Extensions proposal is very flexible and has the potential to support endless of features to fulfill most of the real life needs. However, opposed to the simplicity of Mixin Kernel, Domain Extensions’ flexibility prevent them from being in used, and indeed they are over complicated to implement correctly, thus sacrifice security without the governance of the strong Mixin Kernel PoS ledger. The Mixin Trusted Group is the result of simplifying Domain Extensions, it reduces the feature set to a multisig custodian, and is an open source program runs by several selected participants.&lt;/p&gt;

&lt;p&gt;Unlike every smart contract is executed by the huge state machine in all Ethereum or EOS nodes, MTG  is only running by nodes selected by the program respectively. The solution is very similar to what those Ethereum folks have been planning for years, sharding Ethereum, every MTG is as a shard to Ethereum, and it’s also interesting that MTG is a second layer solution to Mixin Kernel, while the Kernel is already a second layer to many other distributed ledgers like Bitcoin or Ethereum.&lt;/p&gt;

&lt;p&gt;To make Mixin Trusted Group easier to implement, the program may use the API provided by Mixin Messenger, to loop all their multisig transactions. For every UTXO belongs to their multisig group, they should save the UTXO in their local storage to make it easier for further query, then they do whatever they need to do with the memo associated with UTXO. A simple decentralized AMM similar to Uniswap could be implemented in below Golang snippet.&lt;/p&gt;

&lt;div class=&quot;language-golang highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;// this is a simple Mixin Trusted Group to do decentralized AMM&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;checkpoint&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;readCheckPointFromLocalStorage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;// loop all the multisig UTXOs belong to the group&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;fmt&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Sprintf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/multisigs?offset=%s&amp;amp;limit=100&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;checkpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;utxos&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;requestAPI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;GET&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 

    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;range&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utxos&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;// parse the UTXO to make sure it&apos;s valid&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;parseUTXO&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ValidForThisGroup&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// also good to refund it if possible&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;// save the UTXO to local storage for further query&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;writeUTXOToLocalStorage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

        &lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Action&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;ADD-LIQUIDITY&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// do liquidity calculation and return the liquidity provider token&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;lp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;doAddLiquidity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AssetId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ToAssetId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// the LP token also managed by MTG, send LP to the UTXO sender&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;signMultisigRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FromUserId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AssetId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lp&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// if the multisig request finished by enough signers, send out&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Signers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Threshold&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sendRawTransaction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Raw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;SWAP&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// do swap calculation and return the amount swapped out&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;doSwap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AsestId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ToAssetId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// the swapped asset also managed by MTG&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;:=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;signMultisigRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;res&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;FromUserId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AssetId&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;amount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;c&quot;&gt;// if the multisig request finished by enough signers, send out&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Signers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;utxo&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Threshold&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;sendRawTransaction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;multi&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Raw&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After the program pass all tests, the owner should select some trusted nodes to help them run the program. The selected nodes should do full audit of the code to make sure its security, then the nodes will run the program in isolated secure environment, after all selected up, a Mixin Trusted Group is running. Thereafter, all users of the MTG can ensure their cryptocurrencies won’t be stolen by anyone unless most of these nodes are cheaters, they can safely use the MTG like they trust an Ethereum smart contract. Compared to Ethereum smart contract, a Mixin Trusted Group is more likely to be audited by experts, and more importantly, MTG is always faster and cheaper to use than any smart contracts.&lt;/p&gt;

&lt;p&gt;Finally those selected nodes running Mixin Trusted Groups will get continuous income from the Group owners as the nodes spent their efforts on ensuring the security of their programs. Nodes make money, and Groups are trusted by people and they use them more and the groups make more money, and people have their money secured, all benefit.&lt;/p&gt;
</description>
        <pubDate>Fri, 11 Sep 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/mixin-trusted-group</link>
        <guid isPermaLink="true">https://ren.ceo/posts/mixin-trusted-group</guid>
        
        
      </item>
    
      <item>
        <title>Swap the Ocean</title>
        <description>&lt;p&gt;The insane DeFi has driven many people crazy, the base to all of those projects are those swaps, notably Uniswap, now the shining Sushi. Nothing more to talk about them, all is crazy, but good. This crazy has attracted more developers on Ethereum platform, though we have the cool Mixin Network, we don’t have swaps available. Now I propose a swap engine to make swap easier than ever and anywhere else, by facilitating hundreds of millions of dollars worth cryptos in the network, and most importantly the free and instant finalization.&lt;/p&gt;

&lt;p&gt;The core of swaps is a formula to calculate price by liquidity, for Uniswap it’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x * y = k&lt;/code&gt;, where both &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;y&lt;/code&gt; are token amount, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; is an invariant, and it remains the same whenever a trades happen. Let’s say we have 100 XIN and 10 BTC in the liquidity pool, i.e. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x = 100, y = 10&lt;/code&gt;, the formula would be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;100 * 10 = 1000&lt;/code&gt;. Whenever a trade happens, someone deposits 1 BTC to buy some XIN, the formula should be calculated as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(100 - x) * (10 + 1) = 1000 =&amp;gt; x = 100/11 = 9.09&lt;/code&gt;, i.e. they buys 9.09 XIN with 1 BTC. Of course we don’t mention swap fees yet, Uniswap charges 0.3%, and after the trade, the fees will be provided as liquidity. When provides liquidity to the pool, the invariant &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; should change, and a larger &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;k&lt;/code&gt; means deeper market, ergo lower price slippage.&lt;/p&gt;

&lt;p&gt;We already have the Ocean as an decentralized exchange, which provides a traditional order book engine, that is almost impossible for Ethereum, and that’s why they have such innovations like Uniswap to take advantage of their slowness. That says we could make Ocean as a swap engine in no more than hours engineering efforts. Right now when a transfer to an Ocean broker is received, the engine puts an entry in the order book according to the legit memo, otherwise rebates it. To make it work as a swap engine, we needs a formula and somewhere to handle the liquidity pool, as the pool requires both tokens provided at the same time, but the simplicity of Mixin Network allows only one exact transfer per snapshot. Still pretty doable, now the proposal to swap the Ocean.&lt;/p&gt;

&lt;h2 id=&quot;incentives&quot;&gt;Incentives&lt;/h2&gt;

&lt;p&gt;Incentives make things bootstrap easier, we borrow the idea from SushiSwap, and make a token called SHIP, which represents the privileges of the Ocean, 0.05% of all fees will be distributed to SHIP holders. SHIP will be minted every hour proportionately to all liquidity providers based on their XIN value, and for the first 2 weeks the mint is 10x faster to reward early adopters. Besides SHIP, we have DROP as the liquidity providing token per market, the same as those Uniswap LP tokens, and 0.25% of all fees will be distributed to DROP holders. DROP is minted the same as Uniswap.&lt;/p&gt;

&lt;p&gt;There is no way to make tokens in Mixin Network, so we make a single SHIP ERC20 token contract on Ethereum, and one DROP ERC20 token contract per Ocean Swap market. Again the simplicity of Mixin Network allows only simple transfers, no mints, so we make all tokens 1 billion in total supply on Ethereum, and transfer all of them to the Mixin Network account of Ocean Swap engine, then make its accounts transparent by providing its access token. All liquidity pools are also transparent, so that the SHIP and DROP  distributions could be validated by all that no frauds happen. Both cons and pros are in this solution, it relies on some central engine distribution, but provides better security against hacking, and the same transparency as Ethereum contracts. More over, the central engine can be improved further by multisig.&lt;/p&gt;

&lt;h2 id=&quot;provide-liquidity&quot;&gt;Provide Liquidity&lt;/h2&gt;

&lt;p&gt;The very first step is to provide liquidity for the pair of tokens to trade, let’s say the BTC-XIN market. There is no liquidity at first, and the first provider will define the price. The first who makes two legit transfers will be the first provider.&lt;/p&gt;

&lt;p&gt;All Ocean Swap transfers should have their memos encoded in the following binary format, and make base64 conversions before sending out.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;BASE | QUOTE | ACTION | EXTRA
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;BASE&lt;/strong&gt; and &lt;strong&gt;QUOTE&lt;/strong&gt; are the binary UUID of the tokens. In this case, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c6d0c728-2624-429b-8e0d-d9d19b6592fa&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;c94ac88f-4671-3976-b60a-09064f1811e8&lt;/code&gt; in binary format. To make things easier, the engine will only accept XIN as the QUOTE for now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ACTION&lt;/strong&gt; is one byte where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; is swap, i.e. trade, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; is mint, i.e. provide liquidity. In this case, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXTRA&lt;/strong&gt; here should be a binary UUID, it must be identical for both token transfers for the same liquidity providing operation, and must not be same as any other UUID.&lt;/p&gt;

&lt;p&gt;Whenever the swap engine receives a mint transfer, it will wait like 5 minutes for another transfer with the same EXTRA. And if the other one arrives on time, the engine asserts the liquidity price is in proper range correlates with the existing pool. Otherwise all the first mint transfers will be rebated by deducting 1% fee.&lt;/p&gt;

&lt;p&gt;After a liquidity provided, the engine will sends some corresponding DROP tokens to the provider proportional to the XIN value of provided versus the total liquidity in this market.&lt;/p&gt;

&lt;h2 id=&quot;swap-token&quot;&gt;Swap Token&lt;/h2&gt;

&lt;p&gt;This operation is much easier than providing liquidity, just sends out a single transfer to any broker with a proper memo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BASE&lt;/strong&gt; and &lt;strong&gt;QUOTE&lt;/strong&gt; should be the same format as the liquidity providing action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ACTION&lt;/strong&gt; is of course &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXTRA&lt;/strong&gt; is not needed at all.&lt;/p&gt;

&lt;p&gt;The engine will validate your memo, if legit the swapped token will be transferred to the sender instantly. Otherwise the transfer will be rebated by deducting 1% fee.&lt;/p&gt;

&lt;h2 id=&quot;remove-liquidity&quot;&gt;Remove Liquidity&lt;/h2&gt;

&lt;p&gt;Sends a single transfer of the DROP token to any broker will remove some or all of your liquidities. Since the DROP token already has all the market information, memo is not needed at all. After the engine receives the transfer, two transfers will be sent to the sender instantly, the transfer amount is proportional to the DROP value versus the total DROP liquidity in this market.&lt;/p&gt;

&lt;h2 id=&quot;build&quot;&gt;Build&lt;/h2&gt;

&lt;p&gt;The engine is simple in design, and there are also few promotion ideas.&lt;/p&gt;

&lt;p&gt;We may reward the broker with 0.05% fees, the the DROP holders get 0.2%.&lt;/p&gt;

&lt;p&gt;What SushiSwap does to utilize the liquidity of Uniswap may also apply to Ocean.&lt;/p&gt;

&lt;p&gt;Who will build this engine and swap the Ocean?&lt;/p&gt;
</description>
        <pubDate>Wed, 02 Sep 2020 07:07:07 +0000</pubDate>
        <link>https://ren.ceo/posts/swap-the-ocean</link>
        <guid isPermaLink="true">https://ren.ceo/posts/swap-the-ocean</guid>
        
        
      </item>
    
  </channel>
</rss>
