0

Are there other sources of input to a contract than transaction data or the invocation of other contracts?

I've wondered whether there are other sources of input to a contract than those mentioned above?

If not, how does a contract check for authenticity of the input? Is the calling/called address enough to guarantee that input is only received from those sources?

3

Yes, aside from transaction parameters and call messages there are also block headers and potentially, very occasionally, protocol changes, usually by hard forks.

Some information from block headers can be read directly by the contract with variables like block.timestamp. You can also get the block.blockhash, which by extension can provide proof of any other data in the block. Data you see here can trusted by contracts to the extent that the protocol is able to enforce them. This can be quite complex - for example see Can a contract safely rely on block.timestamp?

Protocol changes can alter data in storage or the meaning of function calls. They are trusted to the extent that if you didn't think a particular chain using particular software was legitimate then you wouldn't care what result the contract got first place.

| improve this answer | |
1

are there other sources of input to a contract than those mentioned above?

No. The only way in is a transaction / call by another contract.

how does a contract check for authenticity of the input?

This is done by the miners, and the rest of the network which verifies the correctness of the transaction. You send out a transaction to a smart contract, and by processing the transactions, the above mentioned parties check, if the smart contract actually allowes you to do what you are trying to (e.g. set a String to a certain value) or not.

| improve this answer | |
  • Transactions have a signature that certifies the owner of the private key is the one sending it. – Ismael Sep 1 '17 at 17:01
  • A more simplified way of saying what I meant to, correct. – Nikita Fuchs Sep 1 '17 at 20:33

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.