I am new in smart contracts and ethereum development DAPPS. I am just curious to know about blocks when they are created and how a block is different from a transaction and a new block is created. When a deploy a contract its also transaction? When I call function in a smart contract which performs update its also a transaction?
If Yes, So when does the block is created?
Consider the following smart contract.
contract mortal {
/* Define variable owner of the type address */
address owner;
/* This function is executed at initialization and sets the owner of the contract */
function mortal() { owner = msg.sender; }
/* Function to recover the funds on the contract */
function kill() { if (msg.sender == owner) selfdestruct(owner); }
}
contract greeter is mortal {
/* Define variable greeting of the type string */
string greeting;
/* This runs when the contract is executed */
function greeter(string _greeting) public {
greeting = _greeting;
}
/* Main function */
function greet() constant returns (string) {
return greeting;
}
function updateGreet(string _greeting) public payable returns(bool) {
greeting = _greeting;
return true;
}
}
The above code is taken from https://ethereum.org/greeter and modified so that anyone can update greeting
string by calling updateGreeting
function in the greeter smart contract. So considering this smart contract.
Please help me understanding the concept.