1

I'm trying to learn about Ethereum Smart contracts and studying example code and existing Dapps. If I understand things (and I probably don't), Solidity cannot create random numbers, so developers need to use a service like Oraclize.

I was stepping through transactions and saw something interesting, a bit confusing:

  1. a transaction is created by the end user by sending ether from their wallet to dapp_smart_contract_1
  2. dapp_smart_contract_1 then sends a transaction to oraclize_smart_contract
  3. oraclize query runs (First, curious how this works. Why do developers need to use Oraclize? Why not setup their own RESTful service or other mechanism?)
  4. oraclize returns a random number by calling dapp_smart_contract_2
  5. dapp_smart_contract_2 transacts with dapp_smart_contract_1
  6. dapp presents the results

It's quite likely that I'm not understanding the process, but if I do, it appears that the dapp developer can alter the results in this setup and have the app still appear to be using Oraclize query results some of the time.

Regardless, I'm curious if there are any weaknesses or vulnerabilities in using a service like Oraclize and also if there are plans to make Ethereum smart contracts "better" so that centralized services aren't necessary?

1

Curious how this works

Furst, you create event for Oracle. In case of Oraclize it's done by calling their method. Then some off-chain bot, which looks for new events, processes it: executing http request and putting result back on chain by calling another contract method. Now, result can be accesses by your contract.

Why do developers need to use Oraclize? Why not setup their own RESTful service or other mechanism?

You do not need. People use it because it's much simplier. You do not need to worry about off-chain bot.

I'm curious if there are any weaknesses or vulnerabilities in using a service like Oraclize

You pay the price of trust(what if Oraclize will stop working? or send skewed data?). Also they take a fee.

if there are plans to make Ethereum smart contracts "better" so that centralized services aren't necessary?

Let's split it onto 2 questions:

  1. Is it possible to use any implicit source of off-chain data? Like miners making request by themself.

No. All results of blockchain execution must be deterministic so everyone can verify block. Different requests make produce different responses. Also, assuming it is not a issue, you will DDoS services because anyone who wants to verify transaction will make http request.

  1. Can we make Oracle decentralized?

Sure. For example, let's choose 50 trusted people who will put the price of USD onto blockchain and then just use median of it. That's how MakerDAO calculates ETH/USD price without trusting everyone.

You can expand this idea by implementing any consensus mechanism.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy