Defi中的关键,智能合约是什么?

白话区块链Published on 2022-10-20Last updated on 2022-10-20

Abstract

常有人问,什么是智能合约? 那么一定得先了解什么是“合约”。

常有人问,什么是智能合约? 那么一定得先了解什么是“合约”。

在日常生活中的合约(合作约定)也就是合作方之间订立的“合同”,现在我们的生活几乎离不开合同,往大说,工作是与公司签订的劳动合同,买房是与房产公司签订购房合同,买保险是与保险公司签订保险合同;往小了说,网购、定外卖、打车、买彩票都是与相关的服务提供公司签订了相应的合同。可以说,有人的地方就用合约。

甚至我们与人打赌,也是一种合约,但如果一旦一方抵赖,那履行合约就会变得困难。如果有一种合约,事先确定了规则,一旦触发相关条款,合约将自动执行,无需人为干涉,也不用担心有人抵赖。是否存在这样的合约呢?还真有,这便是智能合约。

什么是智能合约

智能合约(Smart Contract)是上世纪90年代由密码学家尼克·萨博提出的理念,由于当时缺乏可信的执行环境,智能合约没有被应用和发展,直到以太坊的出现,才让智能合约得以“复活”。

那智能合约到底是什么呢?简单来说智能合约就是用计算机语言取代了法律语言记录条款并由程序自动执行的合约。换句话说,智能合约就是传统合约的数字化版本,跑在区块链网络上,由程序自动执行。

自动售货机、ATM取款机,在某种程度上都可以被理解为执行智能合约的机器,但这都不是真正意义上的智能合约。

智能合约有哪些特点?

与传统的合约相比,智能合约有三大特点:

1、合约内容公开透明

智能合约部署在区块链上,其合约内容自然是公开透明的。

2、合约内容不可篡改

同样,因为部署在区块链上原因,智能合约的内容是无法被修改的。

3、永久运行

运行在区块链上的智能合约,同样被区块链上网络节点共同维护,只要区块链在,智能合约就能永久的运行下去。有种“链在合约就在”的兄弟情义之感。

有区块链三大特点加持的智能合约,与传统的合约相比主要有如下优势:

1、去信任。

由于智能合约是基于区块链的,合约内容公开透明、且不可篡改。代码即法律(Code is law),交易者基于对代码的信任,可以在不信任环境下安心、安全地进行交易。

2、经济、高效

相比传统合约经常会因为对合约条款理解的分歧,造成纠纷;智能合约通过计算语言很好避免了分歧,几乎不会造成纠纷,达成共识的成本很低。在智能合约上,仲裁结果出来,立即执行生效。因此相比传统合约,智能合约有经济、高效的优势。

3、无需第三方仲裁

假设熊大和熊二打赌,赌明天是否会下雨,谁输了的一方就需要给对方100元。如果输的人抵赖,赢了的人就得不到奖励。为此,去找第三方仲裁机构,低效且费时费力。但如果赌约写在智能合约上,在达成赌约之时,各自把100元打入智能合约地址,智能合约根据最终的结果,自动执行,赢的一方拿走所有的奖励。可见,智能合约就无需第三方仲裁。

智能合约真的智能吗?

上面讲的都是智能合约的优点,那智能合约真的是智能且没有缺点的吗?其实不然,智能合约也有它的缺点。

如上文所述,智能合约不可篡改的属性,很容易建立起信任。但同时也有不好的一面,如果智能合约存在漏洞,黑客可以利用智能合约的漏洞,为自己牟利。

举个简单的例子,一台自动售货机,本来售价是5块的饮料,由于疏忽,写成了5毛钱,管理员发现之后,可以立刻改正。但如果这台售货机调用的是区块链上的智能合约,那么这个错误将无法修改,直到里面饮料卖完。

另一方面,智能合约本身无法获取(感知)外部的信息,涉及到需要外部信息才能裁决合约,需要对其写入相关信息,它才能作出裁决。比如熊大和熊二打赌明天是否下雨的例子,智能合约本身是不知道第二天是否下雨了没,需要通过其他信息源为它提供信息,比如中央气象台数据,哟了这个信息之后,智能合约才能做出裁决。

从上面两点看,智能合约既不完美也不智能。

小结

综上所述,关于智能合约,我们知道:

智能合约是用计算机语言取代了法律语言记录条款、由程序自动执行的合约。部署在区块上的它,也具备了区块链的数据公开透明、不可篡改、永久运行的特点。

与传统的合约相比,智能合约有去信任、安全、高效、无需第三方仲裁的优点。但智能合约并不完美,而且也不智能或者说它的智能程度很低。

文章中提到智能合约的执行无需第三方机构裁决,同时又提到,当执行条件涉及到外部信息时,智能合约无法感知,需要对智能合约输入相关的信息,才能触发智能合约去执行裁决。

Trending Cryptos

Related Reads

Giants Wage the Context War, Reconstructing AI Moats

The article "Giants Launch the Context War, Reconstructing AI's Moat" discusses how leading AI companies—OpenAI, Anthropic, and Google—are shifting their competitive focus from model size to acquiring, managing, and utilizing user context (Context). Initially, Context referred to the length of text a model could process, leading to a "arms race" for longer context windows. However, the competition has evolved through three key phases: expanding text capacity (long context windows), enabling memory across sessions, and finally, integrating AI into real user environments like browsers and desktops to capture dynamic task states. Each company is pursuing a distinct strategy. OpenAI is building Context around the ChatGPT account, turning it into a central hub that accumulates user understanding across various integrated applications and tools. Anthropic, lacking a major user base, focuses on high-value verticals like coding, empowering its Claude model to actively gather Context through GUI interaction (Computer Use) and system connections (MCP protocol). Google, with vast existing user data from products like Search and Gmail, faces the challenge of restructuring this data into actionable, AI-understandable Context for its Gemini model within its ecosystem. The core argument is that the nature of competitive advantage in AI is changing. The internet era prized network effects—connecting more users. The AI era values "individual depth": the ability to build deep, task-specific understanding of a user. This creates a new moat through 1) the compounding value of accumulated Context, 2) deep integration with user tools and permissions, and 3) the establishment of trust for complex tasks. Therefore, the battle for Context is fundamentally about capturing "task entry points" and converting existing digital ecosystems into environments where AI can effectively understand and act, rather than merely scaling user numbers.

marsbit16m ago

Giants Wage the Context War, Reconstructing AI Moats

marsbit16m ago

Foundation Steps Back, Ethlabs Steps Forward: Ethereum Undergoes Its Largest Restructuring in History

On June 23rd, the Ethereum ecosystem witnessed two major shifts, signaling a significant governance realignment. First, former Ethereum Foundation researchers established Ethlabs, a new independent non-profit. Backed by major ETH holders like Bitmine and SharpLink, Ethlabs aims to address practical needs for institutional adoption, including faster settlement, native asset issuance, cross-chain transactions, and mainnet scaling. Secondly, the Ethereum Foundation announced a major restructuring, laying off 54 employees (20% of its staff) to become a leaner entity focused on protocol governance and maintenance rather than being the primary builder. This move represents a pivotal correction. Criticisms had mounted over the Foundation's perceived slowness, lack of clear strategy, and over-reliance on Vitalik Buterin's influence. Ethlabs emerges as a more execution-oriented, "industrialized" layer focused on market adoption—bridging the gap between research and real-world use. Notably, Vitalik Buterin is absent from its list of supporters, interpreted as an intentional step to avoid excessive personal endorsement and allow the organization to build independent credibility. The Ethereum Foundation's downsizing and redefinition mark a retreat from its former central coordinating role. It now aims to share the "privilege of stewarding Ethereum" with other emerging groups like Ethlabs, the Ethereum Applications Guild, and The Ethereum Economic Zone. Analysts frame this dual shift as the Foundation ensuring Ethereum remains "correct" (credibly neutral), while Ethlabs must prove it remains "effective" (competitive and attractive for capital and adoption). This addresses community "shareholder-like anxiety" about ETH's market performance. While risks exist—such as concerns over shifting from Foundation centrality to large-holder influence—the consensus is that the greater risk for Ethereum was inaction, caught between technical idealism and organizational inertia. These steps aim to create a more multi-stakeholder, execution-driven future for the network.

链捕手7h ago

Foundation Steps Back, Ethlabs Steps Forward: Ethereum Undergoes Its Largest Restructuring in History

链捕手7h ago

Second Half of U.S. Crypto Policy: The Clarity Act Aims for 60 Votes, CFTC's "One-Person Commission" Becomes Biggest Variable

In a pivotal year for US crypto policy, the "CLARITY Act" is advancing in the Senate but faces a high hurdle, needing 60 votes to pass. Key challenges include bridging partisan divides on ethics and swaying undecided Republican senators within a tight legislative calendar of only about 40 working days. The policy "second half" involves intense negotiations on a broader framework for Web3 and DeFi, including crypto tax reforms and the Blockchain Regulatory Certainty Act. A significant uncertainty is the understaffed CFTC, operating with four commissioner vacancies, which complicates regulatory clarity. Meanwhile, the departure of key "crypto champions"—SEC Commissioner Hester Peirce and Senator Cynthia Lummis—will impact ongoing policy efforts. Industry experts are cautiously optimistic but realistic. Sara K. Weed notes that while progress is being made, CLARITY is unlikely to pass this Congress, pushing agencies like the SEC and CFTC to provide more guidance. Sulolit Mukherjee suggests meaningful crypto tax legislation is more likely to be attached to larger must-pass bills. Rashan Colbert discusses the jurisdictional debate over prediction markets, emphasizing the need for a regulatory framework that fosters their development as financial tools rather than treating them broadly as gambling. The clock is ticking, but opportunities remain for substantive progress through continued bipartisan dialogue and pragmatic efforts.

marsbit10h ago

Second Half of U.S. Crypto Policy: The Clarity Act Aims for 60 Votes, CFTC's "One-Person Commission" Becomes Biggest Variable

marsbit10h ago

Dan Koe's New Essay: Escaping the Fate of the Wage Slave, How to Survive the AI Replacement Wave?

Dan Koe argues that the true threat in the AI era isn't technology itself, but a reliance on others for one's livelihood and happiness. The core problem is "wage slavery"—spending life on unfulfilling work. To survive and thrive, one must escape this by building their own enterprise. The key is developing five elements: Agency (initiative), Taste (discernment), Persuasion, Persistence, and Iteration. These boil down to problem-solving skills and experiential knowledge, which cannot be learned passively but only through doing your own projects. The solution is to become "unemployable" by shifting your identity. This requires: 1) Radically changing your environment to force growth, 2) Choosing a medium (like content creation) that provides real feedback through trial and error, and 3) Mastering either code or, preferably, media (content). Content creation is more valuable because its subjective nature and need for human perspective create a durable advantage over generic AI output. To start, define your life's work by answering foundational questions about your innate knowledge, unique abilities, and contrarian beliefs. Then, immediately act by publishing your first piece of content. The cycle of creating, receiving feedback, and iterating is the essential path to developing the skills needed for an independent, meaningful career and financial resilience.

marsbit11h ago

Dan Koe's New Essay: Escaping the Fate of the Wage Slave, How to Survive the AI Replacement Wave?

marsbit11h ago

Trading

Spot
Futures

Hot Articles

Discussions

Welcome to the HTX Community. Here, you can stay informed about the latest platform developments and gain access to professional market insights. Users' opinions on the price of ETH (ETH) are presented below.

活动图片