1

Maybe I'm wrong, but I understand that Smart Contract Transactions must always contain a "VALUE" field, that's to say, the amount of Ether Alice will transfer to Bob in case certain condition accomplishes.

Taking this into consideration, ¿does it means that Ethereum Smart Contracts can't be used to set clauses which don't involve Ether? Like for example:

a) IF Alice transfers the Property Title of a house to Bob, THEN Bob in exchange transfers her another Property Tittle;

Or for example: b) IF Temperature value for January is below X, THEN Insurance decreases the insurance prime for next month;

c) IF consumer A buys something but it's broken, THEN gets (non monetary) compensation from the seller.

In case this is possible, nodes will have a compensation according to used Gas, even if there's no an Ether transaction between the parties. Isn't it?

Thanks in advance.

1 Answer 1

0

You misunderstand.

Transactions contain data and value at the protocol level. data is for possible interpretation by a smart contract. value may contain a non-zero value and the protocol itself enforces rules such as not spending ETH the sender doesn't have.

A transaction can be strictly about data and possible state-changes in contract storage. In all cases, the execution cost (computational weight) is expressed in units of gas and the gas is paid for with ETH.

Here is a simple contract that is unconcerned with value transfers. It would cost a small amount of ETH to pay for the gas to invoke set().

pragma solidity 0.4.25; 

contract Simple {

    uint public number;

    function set(uint _number) public {
        number = _number;
    }
}

Hope it helps.

3
  • 1
    To further clarify, when you send a transaction to invoke the smart contract, yes, the transaction will have a value field, but the value can just be 0.
    – user19510
    Commented Nov 13, 2018 at 18:10
  • Thanks for your answers. Just one doubt left: when transfering ETH, miners verify the transaction in order to check if there's no fraud (existance of funds and not double spending). But in cases like these where there is no money ("value") transfer but only "data", is there something they verify in order to approve the transaction?
    – Niak3
    Commented Nov 13, 2018 at 19:03
  • That's a bit misunderstood. Everyone verifies. Miners only compete to disambiguate the order of the transactions. The confusion is partly about the use of terms because the average user will wait for a transaction to "verify" but they really mean "appear in a block". Once it appears in a block, then everyone will have a look to see what it does. In case it's not clear, consider an invalid transaction. It will still be included in a block so everyone can agree it mined at a certain row in a certain block and it was not allowed to update the state. Commented Nov 13, 2018 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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