Can an Ethereum contract reference something external?

mdeadymdeady IrelandMember Posts: 11
I haven't written a contract yet. Sorry if it's a stupid question.

What I mean is: can a contract make a call to some interface that's publicly accessible over the internet to, say, check some condition before doing something?

Best Answer


  • mdeadymdeady IrelandMember Posts: 11
    edited October 2015
    I see. So can only push input to ethereum, not pull it. And come to think of it, if it were possible to pull then it would affect how long it takes to run contracts. Furthermore, since every miner runs all contracts, all the miners would simultaneously call all the same interfaces - not good. Now that I've thought about it more: very bad idea LOL
  • LarsPensjoLarsPensjo SwedenMember Posts: 35
    Still, the question is interesting, and there are several ways to address it.

    A data feed would kind of "solve" the problem, and there are already such feeds (see PriceFeed). One problem with data feeds is that they depend on a centralized source. One way around this, e.g. providing a price for ether, is to use more than one feed and compute the median value. Better, bot not perfect. I made a script (checkAllBalances) that lists your accounts and their current values in BTC and USD (costs no gas to execute, and so need not to unlock account).

    Still another solution can be a decentralized source of information, similar to what is planned for Augur. You have a number of judges that report on the "correct outcome". There is an ingenious way to ensure they report true, which is complicated. They will in practice lose money of they vote against the general opinion.

    I am sure there are more ways, but there can't be a perfect.
Sign In or Register to comment.