Future of Smart Contracts

Rising regulatory pressure and new technologies will change the way we build and use decentralized services built with smart contracts.

Future of Smart Contracts
Storm brewing over the beaches of cryptosphere. Generated by www.midjourney.com

Since its very inception, crypto elites have generally understood crypto as a remote, digital island, far removed from any jurisdiction. A digital, offshore, place of plenty, virtual islands of Cayman. A place where you can, should you want to, execute heinous financial crimes with absolutely no consequence. And the list of such crimes is so long and so (in)famous that I feel no need to corroborate on this statement at all.

Speaking of distant shores and financial crime, I wrote the paragraph above a week before the FTX debacle.

It’s not all dark and gloomy, however. Blockchain is a technology — like any other. It’s up to developers and users to choose what to build with it and how to use it. Distant shores of the cryptosphere enjoy freedom from any sort of governance and control. Blockchain developers can freely innovate with their open-source applications and platforms.

It is a fintech Petri dish.


Smart Contracts & Dapps

Before I elaborate on my vision for the future of smart contracts and their role in the future of DeFi and cryptocurrency in general, let me define what smart contracts are.

All smart contracts can be summarized to an “if X, then Y” statement.

That’s it. That is the gist of it.

“Dapp” is an acronym often associated with smart contracts, and it stands for “decentralized application”, meaning it’s a relatively complex application that does some financial wizardry on-chain, and people can interact with it by sending tokens or coins to address(es) associated with the smart contract.

In case smart contracts are hosted on a public blockchain, like Ethereum, they are fully public. Every interaction with every smart contract is public information.


My thesis here is that due to mounting legal pressure, the way smart contracts are understood and used will change dramatically. There is still strong demand for offshore financial services, and it will likely grow stronger in the upcoming period as there is an ongoing implosion of so many CEX-es. A surge in popularity for DEX-es is expected in the coming months and years. There is a gap in the market, and something will fill it.

If it is not clear already, I see the desire to have offshore financial services for the masses as the primary driving force behind most (if not all) crypto innovation and adoption. Regulatory Arbitrage.

Source: https://twitter.com/peerchemist/status/1597163170098868224

What I expect for smart contracts and offshore financial services can be summarized in several bullet points:

  • Legal pressure will continue to mount on the entire crypto scene, forcing tectonic shifts and changes in the balance of power,
  • More and more smart contracts on Ethereum will effectively be censored, creating a small but noticeable exodus from the platform,
  • Appchains will grow in popularity,
  • Rollups (of all forms) will rise in popularity,
  • Privacy schemes like ZK-snarks will mature and grow in popularity,
  • Off-chain, second layers like payment channels will reach maturity (in this aspect) and will compete against on-chain services to provide a platform for complex financial interactions.

Chapter 1 - Not So Offshore After All

Ian Balina, a well-known crypto-grifter of the Ethereum generation, and his case is evidence that crypto is no longer an island and it’s not as offshore as imagined.

The SEC case against self-described crypto influencer Ian Balina has revealed how the regulator could further exert its jurisdiction over the Ethereum ecosystem: by claiming all transactions on the network occur in the US.

Thing is, using smart contracts to organize and execute financial crimes works, and it is efficient. It is perfect as long as you believe that crypto is an island, and the only law on the island is the law of the jungle. Dog eat-dog mentality.

But it’s not true anymore. It was only true due to the fact that regulators are always late. And in the case of crypto, they were not just late, but also largely uninterested in crypto affairs. What has changed is that the economic damage caused by various Ponzi scheme implosions, unregistered security token sales, and straight-up theft against citizens became too much to ignore.

Blockchain networks are networks of computers, computers that parse and act on transactions, transactions that describe some sort of financial interaction between various Bobs and Alices, Davids, and Christophers. There are real people behind pubkeys, people who have their nation-states. They are taxpayers and voters. They are citizens. Not just the people, computers are real too. They physically exist somewhere, they use the infrastructure, they draw electric power, need maintenance, and so on.

In essence, the SEC claims that they have jurisdiction over crimes committed by the ICO people (like Balina), because the majority of Ethereum nodes are located in the USA.

The US is indeed home to 43% (3,371) of all Ethereum nodes (7,831), according to ethernodes.org, more than any other country. Germany comes in second with almost 12% (912), followed by France with 4.5% (351).

This is not surprising at all given that Ethereum is highly computationally intensive (especially storage), and Ethereum nodes usually operate in data centers.


Tornado Cash

Tornado Cash is a coin “mixer”, a contract that tries to decouple the sender and recipient in order to protect user privacy in an otherwise public network. Security through obscurity type of thing.

According to the U.S. Treasury Department, Tornado Cash has allowed several terrorist or otherwise criminal organizations (DPRK for example) to launder digital assets. According to the department, Tornado Cash has been issued warnings but has failed to meet demands from the authorities.

Despite public assurances otherwise, Tornado Cash has repeatedly failed to impose effective controls designed to stop it from laundering funds for malicious cyber actors on a regular basis and without basic measures to address its risks. Treasury will continue to aggressively pursue actions against mixers that launder virtual currency for criminals and those who assist them.

On Aug 8th, 2022, the U.S. Treasury Department’s Office of Foreign Assets Control officially sanctioned 45 Ethereum addresses, one of them being the address of the Tornado Cash smart contract.

But “Tornado Cash” is not a company or an entity; it’s a decentralized, immutable, non-custodial smart contract. Thus, the Ethereum community has kicked, screamed, and protested in an effort to paint this move by the U.S. Treasury Department as an attack on all of cryptocurrency, and as a major overreach by the department. In vain, however, Tornado Cash has effectively been eliminated from the ecosystem.

According to mevwatch.info, over 70% of Ethereum blocks made in the last 30 days comply with OFAC guidance on sanctioned addresses.

Source: https://www.mevwatch.info/

All it took for Tornado Cash to disappear was that proclamation by the government agency. The government agency did not exploit the contract, nor attack the Ethereum network, none of that. There is no need for that, as the government knows that everyone will fall in line, and they did. They will fall in line every time.

Check the list of the “offending” block producers below. Each is a multi-billion company that has every interest in continuing to do business in the USA. They will not risk their money flow for the sake of some random smart contract or “principles of decentralization and censorship resistance”. This is business, and the Ethereum community should accept that. Ironic, given it’s Ethereum’s fault the cryptocurrency scene became all about business anyway.

Source: https://www.mevwatch.info

So it seems that smart contracts are not so offshore after all. Smart contracts seem to run on someone's soil and interact with someone’s citizens. And finally, block producers are real entities with obligations toward the regulators, and cash flows to maintain.

You could say that Ethereum has begun to “shore”.


Chapter 2. — Appchains

Appchains are not a new idea. The idea to have a network of application-specific blockchains that can somehow communicate with each other has been around since at least 2014. This is a form of horizontal scaling.

The appchain concept revolves around having each individual blockchain application living on its own blockchain. It is quite a loose concept, and implementations vary. Individual appchains can communicate with a main chain, or they can be completely independent of each other. These blockchains can share block producers with each other, or the main chain, but they can also have independent sets of block producers.

Source: cointelegraph.com

Appchain efforts are currently spearheaded by the wider Tendermint community. The entire Cosmos, the flagships project, ecosystem is made of hundreds of appchains that communicate with each other seamlessly using the IBC (interblockchain communication protocol). The motto of the Cosmos ecosystem sets the narrative: "the Internet of blockchains". Tendermint folk have also implemented EVM (the thing which makes Ethereum - Ethereum) into the Tendermint tech stack, allowing relatively easy migration away from the Ethereum ecosystem into the Cosmos.


DyDx

DyDx, a popular DeFi service for trading “perps”, i.e. perpetual swap contracts, has recently announced that they are migrating their product away from the Ethereum ecosystem and will strive to re-implement their entire service using the Tendermint stack. In short, they want to be producing their own blocks, in order to avoid the destiny of Tornado Cash.

Announcing dYdX Chain
Rebuilding dYdX as a standalone Cosmos based blockchain featuring a fully decentralized, off-chain, orderbook and matching engine.

DyDx exchange is currently implemented using StarkWare, a ZK-Rollup solution that offers scaling and reduced fees. ZK-rollups seem to have this mystical aura in the Ethereum ecosystem, and the community seems to count on solutions like this to be the future of the ecosystem. In summary, rollups are second-layer solutions that derive their security from the main chain. The rollup transactions are executed on a separate chain, and after executing transactions on a rollup chain, transactions are summarized and batched, and then posted on the main Ethereum chain.

DyDx has processed between $0.3B and $0.6B of trading volume per day in 2022.

DyDx in its current iteration still depends on the Ethereum ecosystem and its block producers for transaction processing. Given that is the case, U.S.A. authorities, for example, could effectively shut off the service the same way they did with Tornado Cash.

DyDx already forbids U.S. citizens from using their services.

You are not permitted to access the Portal or the Services if you are a citizen or resident of, or physically located in, any of the following jurisdictions: Burma, Cote D’Ivoire (Ivory Coast), Cuba, Democratic Republic of Congo, Iran, Iraq, Libya, Mali, Nicaragua, Democratic People’s Republic of Korea (North Korea), Somalia, Sudan, Syria, Yemen, Zimbabwe, or any other state, country or region that is subject to sanctions enforced by the US Office of Foreign Asset Compliance.

With a move to the Tendermint ecosystem, DyDx is giving up on the behemoth Ethereum ecosystem and its on-ramps, off-ramps, and money flow for the sake of having its own block producers. Independence has its price.

They want to become independent, and running an appchain makes perfect sense in their situation. I expect more high-volume derivative products to migrate away from the Ethereum ecosystem and onto their own blockchains (appchains) in the next 18 months.


Chapter 3. — Off-Chain Smart Contracts

The blockchain is a self-contained peer-to-peer network and does not have access to information outside of the network. Therefore, smart contracts are restricted to access information only available on the blockchain, but there is not much information on the blockchain itself except address balances, and in the case of smart-contract capable blockchains — contract state.

In order to facilitate on-chain sports betting or trading “perps” — Dapp developers must bring in external data, which is done using oracles. The aforementioned DyDx service also uses oracles to make its app logic know about the prices of digital assets on foreign exchanges.

But what if we move the smart contract itself off-chain and have them interact with an oracle directly? That would not only reduce the amount of blockchain bandwidth required to execute such a scheme, but also preserve the privacy of the user because there is no need to publish everything on the chain.


Oracles and smart contracts

Introducing external data to a blockchain network dramatically broadens smart contracts’ capabilities because they can form contractual relationships based on real-world events.
On the left, setup with multiple oracles, and on the right setup with a single oracle.

Oracles in a blockchain network serve as bridges linking the on- and off-chain worlds. They push external data onto the blockchain, which can be anything from a football game’s results to the value of a stock so that data can be fed into smart contracts.

I would argue that smart contracts can’t be truly useful in any real-world application without input from an oracle.


Discreet Log Contracts

Discreet Log Contract between Bob and Alice, mediated by the Oracle.

Discreet Log Contracts (DLC) are a new type of smart contract that can run on a very limited scripting system, like the one used by Bitcoin. Unlike the usual procedures found on Ethereum for example, Discreet Log Contract and most of its activity is not published on the blockchain. Unsurprising that this schema stems from the Bitcoin ecosystem, as no other community of developers is as limited when it comes to the tooling and capabilities of their blockchain. Especially given the inability of the Bitcoin community to find consensus and upgrade (through a hard fork) the capabilities of the blockchain. If DLC schema matures, it will be interesting to see if it gets adopted outside the Bitcoin ecosystem, on less technically limited blockchains.

On-chain contracts bloat the size of the blockchain, which also increases the requirements for running a node on top of higher fees or longer wait times. They are also public with any observer able to see all the interactions.

With DLCs, neither blockchain observers nor Oracles will know the contract terms and the oracle will never know the transaction amounts. Parties are also protected against faulty oracles that would not produce a signature at event occurrence through a refund mechanism. Usually, only two transactions are published on-chain, and DLCs look like normal multi-signature spend. No external observer can learn of the contract’s existence or details from the public ledger, thus they are called — Discreet Log Contracts.


The Discrete Log Contracts involve an arrangement between participants (usually two, but it could be more than that) that arrange a certain set of outcomes, where the outcome is mediated by an oracle.

While research and development on DLCs is still in the early stages and ongoing in multiple R’n’D camps, it is clear that schema offers a good solution for some of the problems I’ve mentioned earlier, privacy, for example. If nobody can figure out exactly what your interaction with Bob is about, there is little they can do to stop it.

It is not hard to imagine how useful this schema would be for many things usually done on-chain. If the schema could be extended to support any number of participants in a big, collective, payment channel, this would extend the usability of DLC schema by several orders of magnitude.

There seems to be a stalled effort to have DLC on the Lightning Network for the sake of implementing CFDs on Bitcoin (see, off-shore gambling again), which is unfortunate as such schema would deliver near-infinite scaling for free, given its fully off-chain nature.

A more frequent settlement interval lowers the capital requirements and risk of stolen funds. Discreet log contracts eliminate this risk completely, but since they are on-chain, they are expensive. Thus, we propose a solution which combines frequent cheap settlement of Lightning/Rainbow network CFDs with the eventual settlement finality of DLCs in case the other party does not cooperate.

DLCs have the potential to open up applications such as peer-to-peer derivative contracts, sports betting, prediction markets, and insurance, drastically expanding the quantity and quality of DeFi services built on top of the Bitcoin network. But why stop there, this schema can support any kind of contract. For example, users could upload a python script to a consortium of oracles and have oracles resolve the contract between the users based on the outcome of the script. This is effectively the same as how we usually use smart contracts, but it is fully off-chain and private. Less blockchain bloat, more scaling, and more privacy. What’s not to like about it?


Conclusion

I’m expecting a resurgence of interest in running smart contracts on top of Bitcoin as technologies like Lightning Network, Discreet Log Contracts, and Spacechains mature. Or any other technology which would allow off-chain execution of smart contracts.

There is of course a lot of criticism to throw at bitcoiners, but the Bitcoin community has always been more mindful of the user privacy, decentralization, and robustness of the systems they deploy. They do these things well. If the Bitcoin community can find a way to make building offshore financial services on top of Bitcoin possible and relatively easy — there will be a strong boom in activity revolving around Bitcoin. And probably not just for Bitcoin, but also for Bitcoin alternatives like Peercoin, which has maintained close compatibility with the Bitcoin ecosystem, but runs on far more sustainable economic and governance models, and will likely outlive Bitcoin. In a way, those who dedicate their time and effort to improve Bitcoin today are improving the Peercoin of tomorrow.

If the experiment with off-chain smart contracts and off-chain interactions with oracles for off-chain events succeeds, there will likely be a surge in similar solutions for different kinds of blockchains. Schema like DLCs can surely work on top of Ethereum or any of the hundreds of other blockchains.

Rollup solutions will continue to lead the scaling efforts in the Ethereum (and clones) ecosystem, while the question of government sanctions against some contracts will spark major controversies and debates in the community. The success of rollup solutions will also change the shape of the entire crypto scene forever. “Layer 1” blockchains could be seen as settlement layers for rollup blockchains, and I can’t imagine that something can dethrone Ethereum in this regard. Despite all of its flaws and lackluster relationship toward decentralization and censorship resistance, I cannot imagine that Ethereum will not stay the “smart contracts blockchain”.

Tendermint / Cosmos ecosystem, despite its shortcomings, will likely dominate the market for appchains in the coming years, or at least until something nicer shows up. Due to regulatory pressure, I am expecting growing demand for Tendermint-based private blockchains.