人工智能是否会毁灭人类论文_自我毁灭会发生什么

人工智能是否会毁灭人类论文

For the purpose of this article, I have read some good sources, starting with “Why Do Smart Contracts Self-Destruct? Investigating the Selfdestruct Function on Ethereum,” a recent publication that really digs into self-destruct mechanisms. The selfdestruct command stands out in the general immutability of the blockchain: selfdestruct renders inoperable a smart contract. A motivating example of why an immutable blockchain needs such a powerful command is reported in this paper:

出于本文的目的,我已经阅读了一些很好的资料,从“为什么智能合约会自毁? 研究以太坊的自毁功能”,这是一部最新的出版物,确实探讨了自毁机制。 selfdestruct命令在区块链的一般不变性中脱颖而出: selfdestruct使智能合约无法使用。 本文报道了为什么不变的区块链需要如此强大的命令的一个令人振奋的例子:

“The DAO attack continued for several days and the organization even noticed that their contract had been attacked at that time. However, they could not stop the attack or transfer the Ethers because of the immutability feature of smart contracts. If the contract contains a selfdestruct function, the DAO organization can transfer all the Ethers easily, and reduce the financial loss.”

“ DAO攻击持续了几天,该组织甚至注意到他们的合同当时遭到攻击。 但是,由于智能合约的不变性,他们无法阻止攻击或转移以太坊。 如果合同包含自毁功能,则DAO组织可以轻松转移所有以太币,并减少财务损失。”

If you want to know more about the DAO attack and its consequences, you can refer to references [2] and [3] at the end of this article.

如果您想了解有关DAO攻击及其后果的更多信息,可以参考本文结尾的参考文献[2]和[3]。

About the opcode that is generated at the compilation of the selfdestruct method there is a nice story about the sensibility of the Ethereum community: Originally the opcode was named SUICIDE but they decided to rename it as SELFDESTRUCT because

关于这是在汇编中产生的操作码selfdestruct方法有一个很好的故事,关于复仇社会的情感:最初的操作码被命名为SUICIDE ,但他们决定将其重命名为SELFDESTRUCT ,因为

“Suicide is a heavy subject and we should make every effort possible to not affect those in our development community who suffer from depression or who have recently lost someone to suicide.” — EIP6

“自杀是一个沉重的课题 我们应该尽一切努力不影响我们发展社区中遭受抑郁症或最近因自杀而丧生的人们。” — EIP6

Below you will find a small toy example that contains the smallest amount of logic to make some tests. It is easily executable using Remix, so you can try it even without installing the development environment.

在下面,您将找到一个小的玩具示例,其中包含进行某些测试所需的逻辑最少。 它可以使用Remix轻松执行,因此即使不安装开发环境也可以尝试。

pragma solidity >0.6.0;contract Storage {
address payable private owner;
uint256 number; constructor() {
owner = msg.sender;
} function store(uint256 num) public {
number = num;
} function retrieve() public view returns (uint256){
return number;
}

function close() public {
selfdestruct(owner);
}
}

Below is what happens after the deployment of the contract. In Remix, each of the methods of the smart contract is easily accessible on the left pane.

以下是部署合同后发生的情况。 在Remix中,可以在左侧窗格中轻松访问智能合约的每种方法。

Image for post
The methods of the smart contract right after the deployment
部署后立即使用智能合约的方法

The first method to test is store, which will just store the integer value passed as a parameter in the internal state of the smart contract. The next method to test is retrieve, which, as the smartest among you might already have figured out, retrieves the value stored beforehand in the internal state. Calling this method before actually storing anything will just return 0 because the variable is zeroed by default.

测试的第一种方法是store ,它将只存储作为参数传递的整数值在智能合约的内部状态中。 下一个要测试的方法是retrieve ,它是您可能已经发现的最聪明的方法,它可以检索内部状态下预先存储的值。 在实际存储任何内容之前调用此方法只会返回0因为默认情况下该变量为零

Invoking the close method will just execute selfdestruct without any further notification than what is reported in the next figure, a correctly executed transaction:

调用close方法将只执行selfdestruct而不会在下图中报告的任何其他通知(正确执行的事务)上发出任何通知:

Image for post

From now on, each interaction with the smart contract will be successful but still will not do anything.

从现在开始,每次与智能合约的交互都将成功,但仍然无济于事。

This is, in a way, an inconsistency: The client that invokes the smart contract is not aware of the fact that the smart contract has been destroyed. For instance, in this particular smart contract, calling the retrieve method before and after the selfdestruct will return no error, and in the particular case where the internal variable contains 0, the two calls are indistinguishable (see the following figure).

从某种程度上讲,这是不一致的:调用智能合约的客户端不知道智能合约已被破坏的事实。 例如,在此特定智能合约中,在selfdestruct之前和之后调用retrieve方法将不会返回错误,并且在内部变量包含0的特定情况下,这两个调用是无法区分的(请参见下图)。

Image for post
The retrieve method called before (first call) and after (secondo call) the selfdestruct
在自毁之前(第一次调用)和之后(第二次调用)调用的检索方法

The wrap up is, selfdestruct is designed to be the extrema ratio for a malfunctioning contract. It is the emergency button, the SCRAM of your smart contract. Still, before calling it, consider adding additional logic to, for example, pass control to another smart contract.

总结来说, selfdestruct被设计为合同失效的极值。 这是紧急按钮,您的智能合约的SCRAM 。 尽管如此,在调用它之前,请考虑添加其他逻辑,例如,将控制权传递给另一个智能合约。

As a further reading, I strongly suggest reference [1], below.

作为进一步的阅读,我强烈建议以下参考文献[1]。

翻译自: https://medium.com/better-programming/solidity-what-happens-with-selfdestruct-f337fcaa58a7

人工智能是否会毁灭人类论文

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值