6

I have not found any place where this topic is well covered. I've been playing around with smart-contracts and trying to figure out what advantages an smart-contract has over plain logging of input parameters.

Mentally I'm just comming to the basic of software development, where I have an algorithm reading input data, processing it according to some algorithm and writing output data/results.

As I see it, if I just keep/save the inputs into the ethereum logs and then use such logs as input to any external software outside the blockchain I can keep a consistent distributed state reusing ethereum infraestructure:

Advantages of Log approach:

  • No risk for buggy smart-contracts. The log have no logic or state, just "probe of fact". If the external program processing them is buggy we can just fix it.
  • Much cheaper. Logging is a few weis per byte, (much much) cheaper than executing a transaction.
  • Much easier to port from one block-chain implementation/environment to another (just replay the logs).
  • Any others?

Disasvantages of Log approach:

  • smart-contracts that depends on the current state of the ethereum block-chain (non-idempotent) or external oracles (input sources) depending on time.
  • No automatic clearing for contracts using "virtual money" (ethers) as payment method.
  • Every client needs to "download" the logs from the block-chain and re-process the computation (Could this be problematic / disallowed in public networks?).
  • Any others?

Postcript: I tried to add the "idempotent" tag but I have not enough reputation. Still I consider "idempotent" is a very important topic for smart-contracts for obvious reasons.

3

First, I think this is an excellent question. I've been thinking along the same lines for a while, but I never put the thoughts in clear words such as these.

All the points under advantages are correct, and important. Cheap being operative.

The first disadvantage is, I think, the rub. In many cases, you cannot properly generate the logs without having some state to make decisions about what log to generate. For example, voting. Without state (i.e. number of votes), you couldn't implement a very good voting system (other than fully open like 'The Voice').

I think there's a disadvantage missing, though. By pushing the business logic off into a non-chain process, you've removed the one thing the blockchain brings: security. Log only smart contracts can be used to later prove something nefarious happened, but it can't be used to stop the nefarious activity the way a stateful smart contract can.

I'm not saying there are no use cases for stateless log-only smart contracts. There certainly are, and these use cases are very interesting.

Love the word 'idempotent.' Would use it if I knew what it means!

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.