Graeme

Posted on May 23, 2021Read on Mirror.xyz

Understanding Primitives

You must concentrate on the fundamentals, at least what you think at the time are fundamentals... Richard W. Hamming, The Art of Doing Science and Engineering

In any area of expertise, it's really the primitives that unlock creativity and higher performance. This is true whether it's mastering the deadlift for functional movement disciplines, Salt, Fat, Acid and Heat for cooking, or something like zero-knowledge-proof verification in crypto.

As you discover the secrets of Salt, Fat, Acid and Heat, you'll find yourself improvising more and more in the kitchen. Liberated from recipes and precise shopping lists...you can make anything taste good. Samin Nosrat, Salt Fat Acid Heat

My own experience has been that the most valuable time spent learning is to study the core primitives in depth. I'll give some examples to motivate this, using features we built this year for Mirror.

Exhibit A - $WRITE Race

$WRITE Race has been successful. But how did it come about? In a discussion that Denis and I had about onboarding new users, while I was on a vacation in Eagle Lake, CA., we articulated a clear problem: we wanted to have the best users join, but we didn't want to be responsible to choose those people ourselves. We wanted the community to develop organically - almost like a living organism.

I first joined crypto through some time spent at a friend's company, Numerai, where I learned about staking using tokens on Ethereum. There is overlap between staking and $WRITE Race, because both are trying to solve the problem of generating high-quality suggestions from a group of people. Both products losely solve that problem by constraining submission via a token, and promising a reward in exchange.

Here, understanding the problem-solution relationship for staking on Etheruem was key to unlocking the mechanism of $WRITE Race. Even if we didn't directly use staking, it was familiarity with that paradigm that unlocked our creativity.

@strollinghome thinking deeply about crypto primitives in the morning at Eagle Lake

Exhibit B - Splits

Many protocols have attempted ways to split funds among a group of accounts. I've seen a dozen of these contracts, and most of them can't scale beyond a dozen recipients because they don't have the right primitive to unlock scalability.

Our solution with Splits was to use Merkle Proofs to allow unlimited split allocations, which proved to be popular. I was familiar with Merkle Proofs from having read deeply through the Uniswap Merkle Distributor.

Just being familiar with Merkle Proofs unlocked a whole new feature, when the problem was presented.

Exhibit C - Crowdfunds and Scaling Crowdfunds

Mirror Crowdfunds have been very successful. We've managed to raise hundreds of thousands of dollars for an incredibly diverse set of projects - from Essays to Novels to Products.

Behind the success of Crowdfunds is a deep understanding simple primitive - minting and burning ERC20 tokens. We mint an ERC20 token when someone contributes to the project, and we burn it when they want to claim the underlying ETH. If you aren't deeply familiar with this mechanism, it might not occur to you as the way to approach the Crowdfunding problem, and you might opt instead for a generic data structure to hold the allocations. I've seen a few implementations like this, and they're just inherently very limited. ERC20s unlock so much more.

More sophisticated is the scaling of Crowdfunds. We scale Crowdfunds by deploying a single logic contract, and then delegating to that contract from each individual crowdfund. This is the proxy pattern that is popular in the Ethereum space. But it really takes being familiar with the pattern to know how to apply this well.

Exhibit D - Signing

Outside of Ethereum, we use a few primitives for cryptographically signing content. In fact, we use this for all verification on the Mirror platform, and have no login sessions. This will allow us to prove that the content comes from the author, regardless of whether we have an API running or not. This will be critical for our decentralization plans.

The signing keys are also not the same as the user's Ethereum public key. This is important, because it allows users to interact on the platform — writing, commenting (soonish), etc — without needing to take our an Ethereum wallet that might have funds on it just to sign a blog post entry.

Understanding how to do this (quickly) meant having deep familiarity with the types of cryptographic signatures that are supported on Ethereum, the browser, and how to string them together to make something that is a good product experience.


I hope I've motivated the case to learn the primitives. I believe this holds true for any endeavor. Feel free to connect with me on Twitter to discuss primitives and crypto more.