Making Smart Contracts Work for Business: How Chainlink, Zk-Snarks, & Sharding Finally Delivered the Holy Grail

Roger Feng
16 min readAug 6, 2019

--

“The most profound technologies are those that disappear. They weave themselves into the fabric of everyday life until they are indistinguishable from it.”-Mark Weiser

Future generations will not even think of smart contracts as an “innovation”. It will so thoroughly permeate their lives that they would find it strange to think that there was once a time when money was not programmable.

Future historians will likely divide the human history of commerce into two epochs; before smart contracts and after smart contracts. After all, programmable money represents the biggest upgrade to the fundamental nature and conduct of commerce that the world has ever seen. As an anonymous member of the Chainlink enthusiast community once remarked:

“Smart contracts are going to change business at the DNA level

But of course, like all past technology revolutions, smart contracts will need to reach a “tipping point” before that desired widespread adoption can occur. Thus, there are two questions we need to ask ourselves:

1. What does the tipping point look like?

2. As of August 2019, have we reached it yet?

To deliver the tipping point is to discover the holy grail of business.

The Tipping Point

Put yourself in the shoes of a mainstream business. From that perspective, try to imagine the perfect smart contract platform. What properties would it have? What properties must it have?

The tipping point to widespread adoption is a public blockchain that has the following four properties:

1. Privacy

2. The option to transact in mainstream fiat currencies (dollars, euros, etc.) instead of cryptocurrencies and be compliant with financial industry regulations (i.e. ISO 20022)

3. Scalability (without sacrificing decentralization or security, i.e. resolving the “trilemma problem”)

4. Connectivity to off-chain, external data (i.e. resolving the “oracle problem”)

And yes, thanks to Chainlink, zk-snarks, & sharding, we have indeed reached the tipping point.

The following discussion explores the details and specifics of how exactly the holy grail was achieved. Note that the discussion will primarily be through the lens of Ethereum, which still has the most community support and mainstream adoption out of any public smart contract platform.

What about private blockchains?

Before we proceed any further, let’s take a moment to address the elephant in the room. After all, the prevailing view has always been that private blockchains are better-suited for enterprise. Let’s critically analyze the two main pros and two main cons of private blockchain.

Cons

1. Centralized and therefore potentially less secure:

It really should not be a big surprise that IBM & Maersk are having a hard time finding customers to join their blockchain shipping consortium. After all, why would other shipping companies want their biggest competitor (Maersk) to be validating their transactions? That’d be crazy.

2. Balkanization:

As bad as centralization is, this is even worse. John Wolpert, an original co-founder of IBM Blockchain, talks about this at length in his excellent article “Safety Without Silos: Why Businesses Will Learn to Love Public Ethereum”.

If every company has its own private blockchain, the result would be a balkanized mess. Given the complexity of today’s B2B ecosystem, imagine the number of blockchain-to-blockchain integrations crisscrossing the globe like a monstrous spider’s web. Neither cost-effective nor feasible to scale.

The whole point of blockchain is to break down siloes, not create more.

“One day you get a call from a very large buyer saying, ‘Would you like to join my private blockchain?’ You say, ‘Okay.’ And then you get the same call from your wholesaler, your suppliers, your shipper, your insurance company and maybe even your bank…or several of each of these! Suddenly you are spending all your time — and a lot of money — juggling dozens of blockchains. When the next partner calls, you say, ‘Just fax me the order.’”-Paul Brody (Ernst & Young)

“You can pay a system integrator a king’s ransom every time you need to connect one company or department to another with it”-John Wolpert

Pros

1. Scalability:

An advantage that is rapidly receding as public Ethereum implements sharding.

2. Privacy:

At this stage in history, public blockchain vs private blockchain is a bit of a misnomer. Aztec Protocol, Zether Protocol, and Nightfall Protocol (all based on zk-snarks) have effectively provided public Ethereum with a “private mode” that can be toggled on/off as desired. Thus, a more accurate distinction would be permissioned private blockchains vs permission-less private/public blockchains.

“By 2020, the concept of public versus private blockchain networks will be relegated to a historical footnote. We will not pit public networks against private networks. Instead there will be public transactions and private transactions, confidential contracts and open contracts, and they will coordinate their scope across bilateral, multilateral and public environments depending on the needs of users — just as messages today pass between private and public environments using common Internet protocols.”-John Wolpert

All in all, private blockchain has two major disadvantages when compared to public blockchain. And even its two initial advantages are quickly receding.

“As time goes on, the technology will improve, and solutions will continue to come up for existing problems. Eventually permission-less platforms will have the performance, scalability and data privacy features that a permissioned platform offers, all without sacrificing things like security and decentralization.”-Harry Papacharissiou (Genesis Blockchain Services)

Property 1: Privacy (of both the oracle service and the public blockchain platform)

Guy Zyskind, the founder of Enigma, famously quipped in his MIT thesis that smart contracts will only be useful for real world business cases if they can become “secret contracts”. He went on to suggest zk-snarks and trusted execution environments (TEEs) as the two most likely solutions. He was dead right.

What are zk-snarks? Zk-snarks are a flavor of zero-knowledge-proof (ZPK). What is a ZPK? In a nutshell:

They allow you to prove that you know something without actually disclosing what that something is.

For a technical explanation, see Vitalik Buterin’s Medium article from 2017. For a non-technical explanation involving 5-year-olds and Halloween candy, see Hackernoon’s excellent piece.

What are trusted execution environments? They are isolated hardware enclaves that allow code to be run with:
1) the guarantee of being tamperproof

2) complete privacy, even from the machine running the code

The most well-known TEE is Intel SGX, with whom Chainlink entered a partnership after acquiring Town Crier.

On May 31, 2019, Ernst & Young published their Nightfall Protocol to Github. It speaks volumes that a venerable accounting firm with over a hundred years of history chose to add privacy features to a public blockchain rather than trying to make it work with private blockchain.

Since then, the community has been active in building on top of the code. From suggesting improvements to providing the less coding-savvy with a plug-and-play Truffle Box. Given that collaborations between the blockchain community and corporate world are generally rare, this is a testament to how well-received Nightfall was.

This is on the heels of two other zk-snark privacy protocols for public Ethereum; AZTEC (Consensys) and Zether (Stanford, JP Morgan). A trend is definitely starting to form.

On the oracle side, Chainlink’s approach is to use a combination of both ZKPs and TEEs to mutually complement each other. The TEE ensures that even the node operator cannot see the data that is being fetched (potentially important for bank accounts, API keys, etc.). Chainlink is still in the process of implementing TEEs, so this information is currently still visible to the node operator (hence the need for certification services).

While TEEs are close to 100% foolproof, there is theoretically a countermeasure to everything. Thus, the team is also working on implementing zk-snarks that can run inside TEEs (which Thomas Hodges spoke about during the Q&A session of the 2019 Trufflecon).

As a holistic system, this is extremely robust. An attacker would have to somehow simultaneously peel all the layers of the onion to do any meaningful damage (when peeling just one layer is already difficult enough).

“Putting it all together, Chainlink offers what they refer to as, a defense in depth approach, meaning they provide smart contract creators with all the options they need, such as TEEs, multiple nodes, multiple data sources, penalty deposits, reputation systems, asymmetric encryption, ZKP, WASM, and OTP + RNG, which offer varying degrees of confidentiality and costs, depending on someone’s budget and security needs.”-Crypto_Oracle, Chainlink and Its 4 Main Use Cases

In the more distant future, zk-snarks can be upgraded to zk-starks to provide protection against quantum computers.

The best part? Zk-starks will actually have better scalability than zk-snarks. Continued privacy protection will not come at the expense of higher gas prices.

For more information on zk-starks, be sure to read Adam Luciano’s explanation.

Property 2: Scalability (of both the oracle service and the public blockchain platform)

To understand the problem, consider the following analogy:

Public blockchain is like a large company where every employee (node) must attend every meeting (confirm every transaction). Imagine how slow that company would run! Customers can make their requests go to the top of the pile, but only if they shell out lots of money (gas fees). And that’s not even the worst part. The more employees (nodes) join the company, the more dysfunctional it becomes! It scales inversely instead of linearly.

While decentralization and security are both extremely high, scalability is completely sacrificed.

There are various Band-Aid solutions, but none convincingly solve the “trilemma”. For instance, EOS sacrifices decentralization by using a delegated proof-of-stake system with only 21 delegates (many of whom are publicly known) that validate all transactions.

Sidechains (such as Lightning Network for bitcoin and Raiden for Ethereum) preserve scalability and decentralization, but at the cost of security.

How does sharding actually solve the problem? Let’s return to our analogy:

In real life, there is only one kind of company where it might not be insane for everyone to attend every meeting. That would be a small startup (i.e. a private blockchain with an intentionally limited number of nodes).

In most cases, large companies split employees into thousands of teams (shards) and only the supervisors of each team (validators) report to senior management (the main-chain). When employees from different teams need to collaborate (as sometimes happens), they can do so via cross-shard receipts. As more employees are hired on, the teams can be restructured (re-sharded). Allowing for linear scaling.

In fact, startup → large company is a surprisingly apt metaphor for thinking about Ethereum 1.0 → Ethereum 2.0:

“Ethereum 1.0 is a couple of peoples’ scrappy attempt to build the world computer; Ethereum 2.0 will actually be the world computer.”-Vitalik Buterin at the first sharding workshop

Since Ethereum was not built from the ground up with sharding, it will need to get there in seven distinct stages (not unlike a game of “word golf”). The first of which is tentatively scheduled to start on January 3, 2020.

In the meantime, builders can use any of the numerous platforms that were built from the ground up with sharding in mind. Some of them, like Zilliqa and Quarkchain, are already compatible with Chainlink.

For a more technical deep dive of sharding, be sure to check out Ramy Zhang’s article.

On the oracle side, Chainlink offers two features:

1) Extremely fast and cost-effective consensus using Schnorr-like threshold signatures. The off-chain version only uses 16k gas.

2) Remember our earlier discussion about TEE hardware being necessary to keep the node operator from being able to see the potentially-sensitive data being pulled? Since you have the hardware already, you might as well use it to perform actual computations and alleviate load from the smart contract platform if necessary.

“Indeed, given truly trust-worthy and confidential oracles, something that SGX-backed systems à la Town Crier and techniques such as zero-knowledge proofs can help achieve, the boundary between oracles and smart contracts may become fluid…Our long-term strategy…. seeks to create a world where oracles are a key off-chain computation resource used by most smart contracts. We believe this will be enabled by building towards a model of fully general, private off-chain computation within oracles whose results are consumed by smart contracts.”-Chainlink Whitepaper, section 6.3 (Page 26)

Of course, this “long-term strategy” should still be considered speculative until Chainlink actually implements TEEs and grows the service provider ecosystem to critical mass. That being said, the team’s vision is definitely ahead of the game: off-chain computation is key to ensuring that the blockchain is not dragged down by massive amounts of IoT data.

IoT represents a big improvement over the current state of big data. Instead of most data being application-generated and not real-time, we will shift to a world where most data is sensor-generated and real-time. The downside to all these real-time insights is that the storage footprint is staggeringly heavy. For instance, Coughlin Associates estimates that a single self-driving car can generate 1 Gigabyte of data per second. Driving for an hour results in 3.6 Terabytes!

The only logical action is to run analysis on incoming data in real time, rather than trying to save or store it. In fact, Cisco predicted in its Global Cloud Index: Forecast and Methodology, 2016–2021 whitepaper that over 90% of data produced by 2021 will be ephemeral in nature.

In other words, it’s meant to be transient by design. Blockchains, by their very nature, are immutable by design. Together, they mix like water and oil. A recipe for trouble.

The solution is to run the raw data analysis off-chain and then only parse along the meaningful, refined outputs to the blockchain. Towards this end, Chainlink is partnering with IoTex to develop IoT-enabled TEE hardware.

Altogether, sharding and TEEs create a computational structure that has superficial similarities with the well-known “cloud-fog-edge” paradigm:

Reminder: Computation boosts are great, but they’re not blockchain’s true primary purpose

The fundamental point of blockchain is not to reduce the raw cost of computation & data storage. After all, big tech companies like Amazon, Microsoft, Google, Salesforce, Tencent, Alibaba, Dropbox, etc. have already perfected the art of cloud services. By their very nature, centralized servers will always have the advantage in computational efficiency (though blockchains may someday improve to the point where these differences are barely noticeable thanks to sharding, etc.).

The point of blockchain is to reduce the cost of establishing trust. Nick Szabo has referred to this as “social scalability” (in contrast with the “computational” scalability we’ve been talking about thus far). Vitalik Buterin has explicitly stated that the point of smart contracts is to accept a small computation penalty in exchange for a giant decrease in “social costs”.

As Alex Coventry of Chainlink once asked, “How much collaboration and mutual aid go unrealized because it’s simply too hard to trust our commitments to each other?”.

What about data storage projects like Siacoin and IPFS? What about decentralized computation projects like SONM and Golem?

Siacoin’s core proposition is not that it is more computationally efficient than traditional cloud services. There is a computational expense to fragmenting data, redundantly storing it, and then reassembling it upon user retrieval. Not to mention that industry probably has an edge over retail when it comes to acquiring the latest and greatest hardware.

Siacoin’s core proposition is that an Airbnb-style data collective will have lower administrative costs than a traditional corporate provider. Along with additional social benefits in downtime-resistance, privacy, security, censorship-resistance, etc.

The same applies to Golem, SONM, etc. Even with a world-class protocol, coordinating physically separated hardware to compute in harmony will inevitably still incur a small latency penalty. All else equal, centralized hardware still has the advantage. Once again, the core proposition is that an Airbnb model will have lower administrative costs.

It’s important to clearly distinguish “social scalability” vs “computational scalability” and not confuse the two. I will fully explore the implications of this in the later discussion about “magic buses and lightweight libraries”.

Property 3: Fiat-compatibility

Most mainstream businesses do not think of cryptocurrencies as “real money”. Furthermore, price volatility creates practical difficulties for transacting in crypto (even when folks want to do so). I talk about the “price volatility problem” extensively in parts 8 and 9 of a previous work.

None of this is meant to be a knock against cryptocurrency, which has a number of merits over fiat. I am merely noting that it is important to account for mainstream businesses’ comfort zones.

As a universal API connector, Chainlink is capable of triggering open banking payments. It is fully compliant with ISO 20022 and has a long-running partnership with SWIFT (though it’s worth noting that there has not been a status update in some time, hopefully SIBOS 2019 provides one).

PSD2 goes into full effect on September 14, 2019. All banks in the European Union will be in full compliance by then. In other words, they must “front-end” their accounts data and make it available to API calls. Approved third parties (i.e. Chainlink node) can directly trigger payments without going through a payments provider.

While America and Japan have not passed similar legislature, many banks are still voluntarily moving forward with open banking. It’s profitable to allow third party developers to create novel revenue streams and customer experiences. It also gives banks a way to stay relevant in an app-centric economy with mobile payments and fintech rivals.

As the open banking revolution unfolds, Chainlink will give smart contracts a way to work with the vast majority of the world’s powerful currencies (USD, Euro, yen, etc.).

All it takes to connect to an authenticated API is an external adapter. A relatively simple task from a coding perspective that anyone in the community can write and contribute to the library (making it very scalable). The Chainlink team has already released adapters for PayPal and Mister Tango (European cousin of PayPal).

“The financial services revolution may not be televised, but it will be run by APIs.”-Bradley Leimer

Property 4: Connectivity to external data

Chainlink has been working on solving the “oracle problem” for a long time and finally delivered mainnet on May 30, 2019.

It’s only been a few months since, but quite a lot has happened. Provable (formerly known as Oraclize) began using Chainlink nodes, finally settling the debate on decentralized vs centralized oracles.

Synthetic Ether suffered an oracle hack of 37 million sETH that could have been avoided by using Chainlink. Fortunately, the funds were later recovered and nobody got hurt. A teachable moment that illustrates the importance of a decentralized oracle.

And of course, both Oracle and Google began partnering with Chainlink to help monetize their API data, create virtuous cycles, and capture the market that Facebook missed.

New node operators come online every week and the network activity has been lively. The Chainlink team maintains a list of certified node operators both in the documentation and through its Twitter announcements. The Twitter user CryptoSponge has also created a helpful Tableau feed of Chainlink job activity:

Perhaps no one captured the gravity of the moment better than Brad Huston:

“The big issue in crypto has been finding that last bridge between crypto, fiat & big data. LINK has done a tremendous job in closing that gap…almost to the point you say: It’s here.”

Magic buses and Lightweight Libraries

Let’s recap the discussion so far. The true purpose of blockchain is to reduce the cost of establishing trust and thereby foster “social scalability”.

Thus, it logically follows that the primary use case for Ethereum 2.0, Zilliqa, etc. should be B2B. To quote myself in an earlier work:

“A buried, tentative conclusion: If smart contracts ever take off, it will do so in the B2B sphere.”

This is why private blockchain is self-ironic and doomed to fail. Its balkanization reintroduces social costs, is antithetical to B2B, and effectively shoots itself in the foot.

Before sharding, public blockchains could not even run simple games (i.e. Cryptokitties) without massive lag. Let alone handle the complexity of B2B contracts and ultimately someday transform business on a DNA level. In a post-sharding world, they’re ready for prime-time.

That being said, it’s important to avoid a mentality of Ethereum 2.0 being a “do it all” platform. Recall that while computation boosts are great, computation efficiency is not Ethereum 2.0’s true primary purpose. Not to mention our earlier discussion about why the immutability of blockchain won’t play nice with massive bundles of transience-intended IoT data.

In other words, we ought to reject the notion that Ethereum 2.0 will displace traditional Web 2.0 data giants. Instead, we will let Ethereum 2.0 focus on doing what it does best:

“What’s new is the notion of using the Ethereum mainnet as a global integration hub…By using a mainnet like Ethereum 2.0, we will be able to treat business integrations more like workgroups and channels on Slack: easy to create, combine and recombine. Your SAP inventory management system, your supplier’s JD Edwards ERP system, and your fancy fintech partner’s blockchain thingamajig can work together in a consistent, repeatable manner without having to set up new infrastructure to accommodate each set of partners.”-John Wolpert describing his magic bus vision

Ethereum 2.0 should be treated as an integration center, not a data center or computation center. A library dedicated purely to hosting B2B contract terms (which is plenty already if we’re being honest with ourselves, even with sharding).

Instead of viewing a “do it all” Ethereum 2.0 as our aspirational ideal, we should view a “lightweight library” as our most desirable outcome.

Properly distinguishing trust vs computation efficiency and expanding the graphic from earlier, we arrive at:

Time will tell whether Airbnb-esque hardware-sharing models of data storage and computation can outcompete the existing Web 2.0 tech giants when it comes to administrative costs. Along with answering whether the market actually cares about censorship-resistance, downtime-resistance, security, privacy, etc. Do users care about these social values enough to actually pay for it? Do they see it as the icing or the cake itself?

Concluding Thoughts

Regardless of Web 2.0 vs Web 3.0 and regardless of crypto vs fiat, one thing is certain:

The tipping point has been breached; the era of business-worthy smart contracts is upon us.

In fact, the only outstanding concerns are timeline questions, not fundamental road-blocks:

1. When will Ethereum 2.0 finally finish all 7 upgrade stages and fully launch?

2. When will large-scale TEE adoption happen for Chainlink? If the Intel SGX-Town Crier partnership doesn’t quite pan out, then what is plan B? Is Chainlink also talking to some of the other blockchain groups that plan to utilize TEEs (such as Dawn Song’s Oasis Labs)?

The ecosystem is quickly evolving from one where fundamental technical problems needed solving to one that merely needs passionate builders to “connect the dots”.

Programmable money has transformed commerce on the DNA level. There is almost no limit to what is possible.

The only thing holding us back is the constraints of our own imaginations. The future is an exciting one and it belongs to the builders. Unstoppable dapps are coming. Make no mistake, the Holy Grail has been found:

--

--