0

If I write a Ethereum contract something like this (taken from https://solidity.readthedocs.io/en/develop/introduction-to-smart-contracts.html)

pragma solidity ^0.4.0;

contract SimpleStorage {

uint storedData;
function set(uint x) {
    storedData = x;
}

function get() constant returns (uint) {
    return storedData;
} }

if someone called the "set" operation, would it be executed 30 time ( assuming 30 nodes are supporting blockchain, at that point in time). Appreciate confirmation one way or other.

( I know similary question is already been asked, though that is not very clear for me atleast, neither I am able to add comment to that question, hence creating new one)

1

Suppose someone sends a transaction, set(10);

Generally speaking, each miner will run the function to assess the result and possibly include it in a block.

After it's mined, each full node will run the function to assess the result.

At the end of this process, the nodes will be in agreement about their independent conclusions about the result of the transaction.

Hope it helps.

  • Thanks Rob, if I understand correctly field store data would be set to 10 in each full node. Effectively nodes are replicating the state, as they do with transaction. Am I getting this right here? – user1687711 Apr 16 '17 at 21:56
  • Exactly. Nodes are replicating the state by completing the computations themselves. As a developer (Solidity) it's usually sufficient to understand this as one computation; backed by a very fault-tolerant platform with considerable redundancy. – Rob Hitchens - B9lab Apr 16 '17 at 22:15
  • @user1687711 Thanks for the "accept". – Rob Hitchens - B9lab Apr 16 '17 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.