Is this assumption correct ?

There is absolutely no way an ethereum contract can send data to the external world. It can only modify its state variables (later stored in the new block)and send messages to other contracts. States can only be obtained by off-chain / offline apps , that simulate contract and read from any of the blocks in local copy of blockchain/states.

3 Answers 3


Yes, this is correct. Everything on the blockchain is public, but only the current state is visible to smart contracts.

Interestingly, using a Merkel proof, you can prove to a contract that another contract has or had a particular value during any block in the past 256 blocks, since the contract can access the past 256 blockhashes.

One little correction: contracts update their state variables during the execution of a block, not in a later block. This can be tricky, since contracts can be called in an arbitrary order decided by the miner, so depending on the order of execution, contracts can do different things.

  • Has anyone made an implementation of getting data from a previous block to a contract and proving it with a merkel proof? What does / would the gas usage look like? Sep 30, 2016 at 0:35
  • I'm not quite sure what this would achieve. The execution of the code itself would only apply to the chainn on which the block is being mined. For example you could have an identical contract on ETC as on ETH chains, both could theoretically grab block data from the past, and conduct a successful proof (although the block hashes may be different if the contract was created after the Hard Fork).
    – T9b
    Oct 4, 2016 at 8:11
  • The block hashes would be different, and it would be extremely difficult to do PoW verification. The better use case is for proving things about the ETH chain, like that a contact's storage contains a particular value, despite that value not being "public" Oct 4, 2016 at 11:28

In the context of your question, you can think of the blockchain as a database. A database on its own cannot "send data to the external world" - it requires some script to query the database and then make the information that is returned available for example via a web interface to the rest of the world.

Your interface with the world, may be hosted centrally or locally, but the underlying database is not generally unless you are talking about a private chain.

  • Thanks for the comments. Just read about events and logs. These seem to be ways for contract code to send data out - outside of state variables. Can someone throw some light please?
    – RajCherla
    Sep 30, 2016 at 11:08
  • You can log events. These are stored by nodes, but not accessible by contracts. You can make an external process to watch the blockchain for particular events and do something (send email, hit a URL etc) if it sees something you're interested in. However, as with contract state, that process needs to be running and connected to a node. Oct 1, 2016 at 3:18

As the other answers stated, yes, the blockchain by itself cannot send or retrieve data to/from the real world.

However, off-chain services can pull information from the blockchain. Everything that happens on-chain is transparent forever, and everyone can see all the data on-chain. Because of this, it's easy to have off-chain services pull and post data based off what happens on the chain.

The entities that get data off-chain and then send data back on chain are known as blockchain oracles. Oracles such as Chainlink allow for frameworks to push and pull data from and to blockchains, but it's not the blockchain itself that does this.

The simplest explanation is with the Chainlink runlog initiator. Basically all it does is read from event logs, and when specific parameters are logged, the off-chain chainlink node picks them up and executes the functions specified in the event log. This is known as the request model and allows Chainlink to access any API. They then return the data in an external transaction so consensus is maintained.

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.