简体   繁体   English

以太坊区块链的state如何更新?

[英]How the state of Ethereum blockchain is updated?

How can I update the status of the blockchain?如何更新区块链的状态?

  1. I issue a transaction and pass an id to the smart contract.我发出一个交易并将一个 id 传递给智能合约。 Smart contract A retrieves data from smart contract B and uses it to check whether a condition in the smart contract is true or not.智能合约 A 从智能合约 B 中检索数据,并使用它来检查智能合约中的条件是否为真。 If checked, save 'id, true' otherwise 'id, false.'如果选中,则保存“id,true”,否则保存“id,false”。 My first question is: should there be a transaction to save this information on the blockchain?我的第一个问题是:是否应该有交易将这些信息保存在区块链上? I only have the initial transaction sending id, so how is this possible?我只有初始交易发送ID,这怎么可能?
  2. I store id, true.我存储id,真的。 After some time the value true becomes false.一段时间后,值 true 变为 false。 But if the old pair was stored on the blockchain and the blockchain is immutable, how can the copy be updated?但是如果旧的对存储在区块链上并且区块链是不可变的,那么副本如何更新呢?

I am using Ethereum我正在使用以太坊

Though blockchain is immutable, it does not mean the current state can not be updated.虽然区块链是不可变的,但这并不意味着当前的 state 不能更新。 Each Ethereum block is a new state that consists of account balances and smart contract variables.每个以太坊区块都是一个新的 state,由账户余额和智能合约变量组成。 The current state is the last valid block which your Ethereum node sees.当前的 state 是您的以太坊节点看到的最后一个有效区块。 History cannot be altered, but the current state can be altered with transactions.历史无法更改,但当前的 state 可以通过交易进行更改。

As the question is overly broad and over basic blockchain concepts, I suggest taking classes in Ethereum smart contract development first.由于这个问题过于宽泛且超出了基本的区块链概念,我建议先学习以太坊智能合约开发课程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM