2

In order to get a better understanding I'm trying to write a simple journal tool on the Ethereum blockchain. The goal is to have a journal that for every entry does prove three things:

  1. The EOA who created the entry
  2. The timestamp the entry was created
  3. The entry itself, which is just a string

The code is as simple as this:

contract Journal {

    event Log(string entry);

    function writeLog(string memory entry) public {
        emit Log(entry);
    }
}

Are the following assumptions corect?

  1. is guaranteed because the event is referencing the transaction hash which is referencing the signer
  2. is guaranteed because the event is referencing the block which has a timestamp
  3. is guaranteed because the event contains the entry

I basically have two questions:

  • Is this a secure and safe way to have a trustworthy journal?
  • Is there a better approach to achieve the same goal?
1

1 Answer 1

2

Yes, however, the function writeLog could be called from another contract instead of an EOA. Also, many contracts include the sender in the event for clarity. You could save tx.origin to always have an EOA in the event log.

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.