“Code is Law” in Crypto & Blockchain: Myth or Effective Framework?
Summary: Explore the “Code is Law” concept in blockchain with Sergey Ostrovskiy. Understand the fundamentals and determine whether this framework effectively governs blockchain transactions or if it remains a dangerous myth that overlooks the complexities of real-world regulations and human behavior
Authors:
Sergey Ostrovskiy
Partner
“Is code truly the ultimate authority in blockchain transactions, or are there unseen legal strings attached?”
Introduction
In the world of crypto and blockchain, the phrase “Code is Law” is often seen as a guiding principle. The concept suggests that the rules embedded in the code of a blockchain protocol or smart-contract are supreme, and once the code is deployed, it operates independently of external control. For many blockchain entrepreneurs and project founders, this idea represents the ultimate expression of decentralisation. But is this concept recognised by actual legal systems? And does “Code is Law” stand up to scrutiny when things go wrong in the real world?
For entrepreneurs and project creators venturing into blockchain and cryptocurrency, understanding the interplay between code and law is crucial. This article demystifies the “Code is Law” philosophy, exploring its implications, limitations, and what it truly means for your crypto project or blockchain protocol.
Code is Law: Definition and Major Catch
At its core, “Code is Law” suggests that the rules embedded in blockchain code and smart-contracts are supreme. Once the code is deployed, it runs autonomously and executes agreements according to its pre-programmed conditions. The appeal here is clear: no middlemen, no courts, no manual intervention—just pure, decentralised logic.
But here’s the catch: while the code governs the transaction’s execution, it doesn’t exist in a legal vacuum. Real-world laws and regulations still apply, overriding the code, and ignoring them can lead to significant legal repercussions.
Let’s consider an example. Imagine you’re a savvy hacker who’s just discovered a blockchain protocol vulnerability. The code has a loophole, and you exploit it to syphon off millions. You think to yourself, “The code allowed it, so it must be fair game, right?” After all, in the crypto world, “Code is Law”—the rules of the code are meant to be supreme, aren’t they? But what you see as a clever move, legal systems might classify as theft or fraud – see below.
Bridging the Gap: Smart-Contracts vs. Traditional Contracts
To better understand how smart-contracts exist within traditional legal systems, let’s compare them to traditional agreements and legal instruments.
Major Differences
In traditional contracts, the intent of the parties plays a central role. Courts give significant weight to what the parties agreed upon and how they interpreted that agreement. When disputes arise, courts often consider ambiguities, interpret unclear terms, and ensure fairness—sometimes even adjusting terms in light of unforeseen circumstances.
Smart contracts, however, lack such flexibility. They execute automatically based on the code’s pre-defined logic, leaving little room for interpretation or adjustment. If there’s a bug or an unforeseen event, the smart contract will execute as programmed, potentially leading to unfair or unintended outcomes.
Intent and Interpretation
In practice, especially in disputes, the intent of the parties and the substance of their actual agreement carry substantial legal weight. If a dispute involving a smart-contract reaches a court, judges are likely to prioritise understanding the true intent behind the smart-contract, taking into account what the parties intended, rather than simply relying on the automated execution.
Courts may intervene if the strict execution of the code results in unjust outcomes, such as cases involving fraud, error, or unexpected circumstances. In such instances, if the smart-contract allowed for an outcome that was not intended by the parties or rendered the transaction unjust, courts might prioritise enforcing the original intent of the parties, even if it means overriding the smart-contract’s logic or automated execution.
Thus, unlike with smart-contracts, traditional contracts incorporate not only what’s written but also the expectations, intentions, and broader context of the agreement. This distinction highlights a critical limitation of smart-contracts: while they provide efficiency and automation, they lack the ability to account for nuance, fairness, and intent. Relying solely on code, especially when dealing with complex agreements or situations where unforeseen events are likely, can result in inflexibility and unfairness.
Legal Theories at Play: Why “Code is Law” Can’t Be Absolute
The debate over “Code is Law” touches upon deeper philosophical discussions in legal theory, particularly between legal positivism and natural law. Legal positivism asserts that laws are human-made rules enforced by societal institutions—courts, regulators, and legislatures. In this view, laws are written, interpreted, and applied by humans, allowing for flexibility and adaptation to achieve just outcomes. Natural law, on the other hand, posits that certain laws are inherent and universal, akin to the laws of nature.
“Code is Law” aligns more closely with natural law, viewing code as an immutable set of rules that govern behaviour without the need for human intervention. However, modern legal systems are grounded in legal positivism, meaning that human-made laws take precedence over self-executing codes.
In the real world, the law always prevails: governments actively regulate blockchain and crypto, with legal systems ultimately overriding any self-imposed “Code is Law” rules. Without legal recognition, the code-based rules lack enforceability. Code can’t handle nuanced human disputes requiring interpretation and judgement.
If Code Is Law, Why Exploits and Hacks are Illegal?
As we know already, an exploit in code doesn’t grant users a legal free pass to misuse it. Just because the code permits an action doesn’t mean it’s legally or ethically acceptable. Code is not absolute and, from a legal standpoint, is subordinate to both the law and the actual agreements between the parties. Therefore, the legality of any action, even if processed through smart-contracts, will primarily be determined by law and agreements, and only then by the code.
The “substance over form” principle, which is widely applied by regulators in various countries, states that the reality and essence of relationships are more important than the formal side or how those relationships are presented. In our context, a smart contract is the form of a transaction, while the agreement and intentions of the parties are its substance.
The “substance over form” approach—widely applied by regulators and agencies—dictates that the substance of a transaction, meaning its actual purpose and economic reality, is what truly matters, while the form or method by which the transaction is executed is secondary. In our context, a smart-contract is the form of a transaction, while the agreement and intentions of the parties are its substance. For these reasons, exploiting a vulnerability in a smart-contract may be considered unauthorised access or hacking. Profiting from an exploit may be classified as fraud or theft. Victims can file lawsuits and involve law enforcement, which could lead to serious legal consequences.
Suppose someone exploits a vulnerability in your DeFi protocol to drain funds due to a coding error. They might argue that “Code is Law” and that they were simply following the rules embedded in the code. However, as previously mentioned, legal systems are likely to view this as akin to bank robbery, despite the “Code is Law” philosophy. The hacker will likely face charges ranging from theft to cybercrime offences, highlighting the supremacy of legal norms over code.
Infamous Case: The DAO
In 2016, the Decentralised Autonomous Organization (the DAO)—the original one—raised over $150 million in Ether, aiming to revolutionise venture capital through smart contracts. However, a hacker exploited a vulnerability, diverting $60 million into personal wallets. Let’s break it down:
- Code Permitted the Exploit: Technically, the hacker followed the code’s rules.
- Community Outrage: Ethically, it was deemed theft.
- Main Question: Was this a legitimate action under “Code is Law,” or a crime?
From a “Code is Law” perspective, the exploit was permissible—the code allowed it. The argument made by some in defence of the hacker’s actions was that since the code allowed the exploit, it was a legitimate action under the system’s rules—this aligns with the “Code is Law” ideology. However, the broader Ethereum community viewed the act as theft and decided to implement a controversial hard fork of the Ethereum blockchain to reverse the hack, effectively rolling back the blockchain’s history to a state before the attack.
This is one of the biggest legal cases demonstrating that "Code is Law" is not absolute, even in blockchain, and exposing the real truth. The Ethereum community’s decision to override the code in favour of what they deemed a just outcome highlights the importance of integrating legal and ethical considerations into blockchain projects and smart contract design.
How Can We Apply “Code is Law” in Practice?
While the philosophy of “Code is Law” offers a compelling vision for the blockchain industry, applying it effectively in the real world requires a more nuanced approach. Here are a few ways businesses, entrepreneurs, and project creators can incorporate “Code is Law” into their operations:
1. Employ Hybrid Structures
Code alone isn’t enough—smart-contracts, while powerful, should be complemented with traditional legal frameworks. To bridge the gap between code and law, a Web3 project can employ a hybrid model: combine automated smart-contracts with proper legal instruments, ensuring a more comprehensive and reliable system. In a hybrid transaction, the code governs its execution, while legal agreements govern the broader context of the transaction itself, such as the legal qualification, terms, and intent of the parties.
Many crypto projects are already employing hybrid structures—often without even realising it. Take the example of token distribution during a private sale. While the distribution process is typically automated through smart-contracts, which execute the transaction itself (e.g., transferring tokens to purchasers or enabling claim), the underlying legal agreement between the project and the token purchaser governs the transaction and defines its essential terms.
2. Implement Emergency Measures
One major limitation of smart contracts is their rigidity. While immutability is often a desired feature for security reasons, it can become a problem when bugs or unforeseen situations arise. To counter this, projects can incorporate emergency measures that allow intervention when needed without sacrificing the decentralisation ethos. For example, smart contracts can be built with features like kill switches, pause features, or governance models that allow the community or project administrators to step in, pause operations, or make necessary changes in case of an exploit or significant error.
3. Ensure Compliance
Despite the appeal of “Code is Law,” legal compliance remains essential. As governments and regulatory agencies across the globe are more and more actively overseeing blockchain activities and continuing implementing new regulations, blockchain projects should pay particular attention to the legal environment and introduction of new rules and requirements.
Final Thoughts
The allure of “Code is Law” lies in its promise of a self-governing digital realm, free from traditional legal constraints. However, the reality is that code cannot exist in isolation from the law. For entrepreneurs and project creators, recognising this interplay is not just prudent—it’s essential for long-term success. Stay proactive, integrate legal considerations into your projects, and seek professional advice to navigate this complex landscape. By balancing the strengths of code with the protections of law, you can build robust, trustworthy, and legally sound blockchain ventures.
Remember: In the journey of innovation, understanding the rules doesn’t stifle creativity—it empowers it.