This has been the problem with smart contracts since day one. It is that simple.
Thank you! I've tried to put it into words before but I think this is as close to perfection as one can get while describing why smart contracts are not what people believe them to be.
This has been seen in practice, for example in the Fulcrum hack:
https://gist.github.com/alexvansande/edcc9fe935b61526766c956...
https://dappradar.com/blog/defi-flash-loan-attack-what-just-...
While Chainlink has its own host of issues and risks, there are still valid reasons why companies are paying them and their node operators good money to feed price contracts for ERC-20 token pairs.
It doesn't have to be an API. Side channel attacks can provide unintentional oracles. For example, if you have a password checking function that takes longer to return a false result for "close" inputs, then it leaks information that can be used to crack passwords (simple O(n) string comparison would be an example)
My uneducated inference is that an oracle is a data source and you can hook into it from the smart contract. The oracle seems to live off-chain and live on a traditional server/DB.
Please correct me if the above is way off!
Decentralization is a spectrum. But I would argue this approach is far more secure than naive oracle implementations.
Not all applications need oracles. It depends on whether your smart contract needs information about the world outside of the blockchain.
However, I can think of an exception. Augur is a prediction market that doesn't use a trusted source to resolve bets. It doesn't get a lot of use these days, and probably won't before scaling resolves gas prices, but the bets that have been live on the system have resolved correctly.
Aside from the amusing programming error, the main problem with much of the "smart contract" activity today is that doing anything remotely interesting requires an oracle. An oracle is basically a server that reports the outcome of an event. And servers can be attacked in ways that systems like Ethereum can't.
So a lot of the hype around Ethereum and its "smart contracts" is really people just misunderstanding the security model. The weakest link is a server in a dorm room or data center reporting a number.
Here the oracle is doing the right thing. But it could easily go the other way.