Original Title: (The Kingdom of Code - A Brief History of 'Code is Law')

Original Author: Wang Chao, Co-founder of Metropolis DAO

In the early morning, the fog enveloping the San Francisco Bay Area, in the office, the blue light from the screen illuminated the developer's tired face. His eyes were bloodshot, and his fingers slid quickly across the keyboard. This was the final check before deploying the contract, where every semicolon and boundary condition could be a matter of life and death. The Telegram channel suddenly erupted. Someone discovered that the project team had violated the token unlock promise in the white paper.

Across the ocean, on a meme player's monitor, countless transaction data weave into a net, tracing the movements of giant whales. DeFi miners are checking the time lock of the new mine: "72 hours," they nod, "safe."

In Discord, a debate regarding the registration of a DAO was heated. Beyond this dispute, an AI Agent silently documented its reasoning process on the blockchain. This is a typical morning in the crypto world of 2024. On the surface, these scenes seem unrelated, but beneath the complex appearances, an invisible bond tightly connects them. That is the belief in "Code is Law."

In this world built on code, code is law, faith, and the ultimate arbiter. This rule acts like an invisible chain, tightly linking this circle filled with speculation, ideals, innovation, and chaos. It is the cornerstone of the crypto world and the soil that breeds countless stories.

But what does 'Code is Law' really mean? How did this phrase evolve from a warning into a belief? To answer this question, we must return to that autumn 25 years ago, back to an office at Harvard Law School...

Code is law

In November 1999, on the Harvard campus, autumn was in full swing. Professor Lawrence Lessig was sitting in his office. He became well-known for serving as a neutral legal expert in the Microsoft antitrust case, and in just a few days, his new book "Code: and Other Laws of Cyberspace" was about to be published.

The internet wave swept across the United States in the 1990s. Years earlier, Lessig had been pondering a seemingly simple question: In traditional society, behavior is constrained by law, morality, market forces, and physical laws. But in cyberspace, these constraints seem to become blurred, yet another type of constraint seems more direct, as system administrators control user behavior by setting permissions. This control is not achieved through threats or punishment but directly determines what is possible and what is not. "In a Unix system, if you don't have permission, you simply cannot open that file," he wrote in his notebook, "This is not a constraint of law, but something more fundamental."

In front of him, a notebook sketched a simple diagram: the layered structure of the TCP/IP protocol. The manuscript stated that this is a revolutionary design where the protocol does not care about the content of the data packets or who you are. It only cares about one thing: transmitting data according to the protocol rules. This 'permissionless' characteristic has made the internet a free land.

But Lessig also keenly noticed that new walls were growing in the free land of TCP/IP. Amazon can shut down your account, AOL can prevent your login, Google can decide what content should be seen. Those commercial platforms built on open protocols are creating new ways of control.

The first chapter of the new book is titled Code is Law, but this phrase is not a compliment; it is a warning. Lessig worried that if business giants and governments controlled the writing of code, they could control the entire cyberspace.

"Every era has its potential regulators that threaten freedom, and we are living in the age of cyberspace, which also has a regulator that threatens our freedom. That regulator is code. It determines how easy or difficult it is to protect privacy and how easy or difficult it is to censor speech. It affects whether information access is universal or tiered and decides who can see what or which content will be monitored. In many ways, we can only gradually realize the regulation of cyberspace when we begin to understand the nature of code."

Two months later, The New York Times published a review of this book, stating:

"These discussions are thoughtful, but the premises that constitute these discussions are unstable; Lessig did not provide much evidence to prove that the loss of privacy and freedom is happening on the internet."

Hehe.

In a sense, Lessig foresaw the future. But he did not foresee that his warning would soon transform into a banner. In Silicon Valley's garages, in the studies of cryptographers, in front of computers around the world, a group of people was brewing a revolution. They would not be enslaved by code but would use code to rebuild freedom.

Smart Contract

In 1994, Washington. A member of the cypherpunks, Nick Szabo, was writing in his humble apartment. On the screen was a paper about "smart contracts". Szabo's apartment was filled with books on law and computer science. As a researcher passionate about both fields, he had been thinking about how to combine the certainty of law with the precision of computer programs. "Imagine an automated vending machine," Szabo wrote, "This is the simplest smart contract. It doesn’t need a judge to enforce the contract, and it doesn’t need police to maintain order; the rules are written into the machine's program."

"Traditional contracts have too many problems," he told the reporter who came to interview him, "Performance depends on people's willingness, and dispute resolution requires long litigation. But if we can encode contracts into programs, they will operate strictly according to predetermined rules. No judges, no lawyers, just code."

The reporter questioned, why should people trust code? Szabo replied with a mysterious smile: "Because code does not lie. It cannot be bribed, threatened, or arbitrarily change its mind. It simply executes the established rules faithfully."

In the subsequently published paper, Szabo elaborated on the concept of smart contracts:

"Smart contracts are computerized transaction protocols that execute contract terms. The overall goal of smart contract design is to meet common contract conditions, minimize malicious and accidental exceptions, and reduce the need for trusted intermediaries. I believe the potential to significantly reduce transaction costs for executing certain contracts and the possibilities of creating new types of enterprises and social institutions based on smart contracts is enormous, but it has not been deeply studied yet."

However, the technological foundation for realizing this vision has yet to emerge. Szabo and other cypherpunks would have to wait many more years.

Bitcoin

On the evening of October 31, 2008, a calm Halloween evening, Satoshi@gmx.com sent out an email that changed history. The subject was simple: (Bitcoin P2P e-cash paper).

This email sent to the cryptography mailing list stated: "I have been working on a new electronic cash system that is completely peer-to-peer, without a trusted third party."

On January 3, 2009, the Bitcoin genesis block was mined. In this system, no one can violate the rules of the code. "Code is Law" transformed from Professor Lessig's warning into the ideal of the crypto community, ultimately finding its first complete practice in Bitcoin.

Ethereum

In the fall of 2013, in a café at the University of Toronto, Vitalik Buterin was sketching diagrams on his notebook. As the editor of Bitcoin Magazine, he had deeply studied every line of Bitcoin's code. But he believed that Bitcoin's design was too conservative. "Bitcoin proved that governance based on code is possible," he told his peers, "but why limit it to just the scenario of currency transfer? If we could create a Turing-complete system..." This idea quickly evolved into the Ethereum white paper. Vitalik envisioned a "world computer": anyone could deploy smart contracts on it and create various applications.

"At that time, many people thought it was crazy," recalled an early contributor, "We were going to build a platform governed entirely by code, allowing anyone to run programs on it. The risks were too high." But this was precisely the upgrade of the 'Code is Law' idea: not only was the platform itself governed by code, but every application running on the platform also followed the same principle.

The smart contracts envisioned by Nick Szabo over a decade ago finally found fertile ground for realization. A decentralized application ecosystem began to form. From simple token issuance to complex financial protocols and decentralized autonomous organizations (DAOs), immutable code began to take over an increasing number of scenarios in this world.

The DAO

In April 2016, in Switzerland, the Slock.it team was introducing their ambitious plan: The DAO, a decentralized investment fund governed entirely by code.

"Imagine a fund without a board of directors and no CEO," explained founder Christoph Jentzsch, "All decisions are made by token holders voting through smart contracts. This is the ultimate practice of 'Code is Law'."

The crowdfunding of The DAO has begun. In just 28 days, it raised $150 million in ETH, setting the record for the largest crowdfunding at the time. "People trust the code," said an early participant, "The smart contracts are public and everyone can verify them. This is not about relying on people's promises but about relying on immutable code."

However, this seemingly perfect code hides fatal flaws. On June 17, 2016, an anonymous hacker discovered a recursive call vulnerability in The DAO contract. Through carefully designed transactions, he began to transfer ETH from The DAO to a sub-DAO. "In theory, this completely adheres to the rules of the contract," a security researcher explained, "The hacker did not 'break' the code; he simply took advantage of the operations permitted by the code. From the perspective of 'Code is Law', this is completely 'legal'." However, after over 3.64 million ETH was transferred, the entire Ethereum community fell into an unprecedented crisis.

"If 'Code is Law', then this attack is legal," one faction insists, "We cannot change the rules just because we dislike the results. This goes against the fundamental principle of decentralization." "But code serves people," another faction counters, "If the code leads to evidently unjust results, we have a responsibility to correct it." Intense debates continued for weeks. Eventually, Vitalik and the core Ethereum team proposed a hard fork plan: roll back the blockchain to return the funds transferred by the hacker to a new contract.

This decision sparked even greater controversy. Some community members insisted on maintaining the original chain, forming Ethereum Classic (ETC). This was not only a fork of the chain but also a split of ideals. "For many people, the pure ideal of 'Code is Law' was shattered," lamented an early Ethereum developer, "We realized that code can never be perfect."

Is Code Law?

In the summer of 2020, the crypto world experienced a new wave: DeFi Summer. Various innovative projects sprang up like mushrooms after rain: Aave's flash loans, Curve's stablecoin trading, Yearn's yield aggregation... Each project is redefining the possibilities of finance through code.

But in the fervor, risks are also accumulating. "Do you remember that YAM?" a DeFi miner recalled, "A small error in the code led to a complete breakdown of the governance mechanism. This reminds us that 'Code is Law' is a double-edged sword. The consequences of code errors can be more severe than human mistakes."

At the beginning of 2022, with the popularity of the Web3 concept, DAOs experienced explosive growth, each exploring new possibilities for decentralized cooperation and governance.

"Initially, we thought that the DAO was just about governance through token voting using code," recalled a member of a DAO, "but soon we realized that reality is much more complex than code. Look at the governance process of each major DAO; on the surface, it is executed through smart contracts, but the real decision-making often happens in discussions on Discord or forums. These politically coordinated efforts that do not rely on code are actually the core of how DAOs operate."

"Code is indeed law, but not the only law," said a core member of a DAO, "It is more like a component of a legal system that needs to work in conjunction with other components—community discussions, expert opinions, real-world constraints, etc."

Just one month ago, Proposal 662 of NounsDAO sparked deeper thinking. While most DAOs primarily rely on human coordination rather than code to operate, NounsDAO had nearly achieved operation solely based on smart contract code. However, Proposal 662 proposed to register a DUNA entity in Wyoming, embracing the off-chain legal system.

This sparked intense debate within the community. "We joined NounsDAO because it proved that a completely code-governed organization is feasible!" an angry member said, "Now you want to replace code with a legal system, isn’t that surrendering to the traditional system?"

"We cannot pretend the real world doesn't exist," said a proposal supporter, "The DAO ultimately has to operate in the real world. Appropriate compromises are not betrayals of ideals but make those ideals sustainable."

Support votes slowly but steadily increased, and the proposal passed.

Almost simultaneously, a new participant entered the crypto world: AI Agent.

In the world of 'Code is Law', AI found its most ideal habitat. The rules here are definite, verifiable, unaffected by human interference, and most importantly, do not differentiate between humans and AIs. The protocols only care whether they comply with the preset rules, allowing AIs to autonomously trade, provide services, and participate in governance, where all decisions and actions can be executed by code.

In a crypto world where code is law and algorithms dominate value, AI Agents have first transformed from a piece of code into a form of existence. As more and more AI Agents join, the crypto world will present a new ecology: humans and AI interact under the same set of code rules, creating unprecedented collaborative models.

Twenty-five years

In just 12 days, it will be the 25th anniversary of the publication of (Code and Other Laws of Cyberspace).

Over a span of 25 years, 'Code is Law' has traversed an unexpected path. It transformed from a warning against digital authoritarianism to a banner of cypherpunk rebellion, continuously tested, adjusted, and evolved in practice. The evolution of this concept reflects our deepening understanding of the digital world:

Initially, Lessig warned us that code could become a tool to control cyberspace. This concern remains profound today—as tech companies influence users through algorithms, and in the age of AI, an insecure model could bring devastating consequences.

Then, the cypherpunks transformed this warning into action. Bitcoin proved another possibility: code can not only limit freedom but also protect it.

The DAO incident acted like a mirror, reflecting the limitations of pure code governance. But this failure was not an end; it was a new beginning. It prompted us to start thinking: how should code and human society interact?

The rise of DeFi has brought surprises: in specific scenarios, code can indeed be more effective than traditional rules. Automated market makers, flash loans, permissionless lending—these innovations demonstrate the unique advantages of code governance.

The evolution of the DAO is the most enlightening. From a dogmatic "codeism" to seeking a balance with the real world, this process reflects an important reality: at least for now, code cannot replace all other rules but must coexist and complement them.

The addition of AI opens up new imaginative spaces. When artificial intelligence begins to operate autonomously on-chain, "Code is Law" may gain new dimensions.

Outside, the morning fog in San Francisco gradually dissipated. A new day began. In every corner of this world, a blockchain network composed of countless nodes is operating. Smart contracts act like tireless guardians, faithfully executing their mission; DAOs are conducting the largest governance experiment in human history; AI Agents are evolving at an unimaginable speed, pioneering new forms of existence in a code-built world.

This is the new world created by code. It is imperfect but vibrant; it has flaws but continues to evolve; it is still young but has shown potential to change the world. It carries the promise of making the world more open, transparent, and fair, even though this promise has not yet been fully realized, every participant is pushing this promise step by step into reality in their own way.

Perhaps this is the most profound insight of 'Code is Law' over the past twenty-five years: it is not a flawless dogma but an ongoing evolving experiment, a continuous process of exploration. In this world built by code, people are not just followers of the rules but also creators of the rules. Every line of code written by people shapes the future world.

Original Link