Hacker News new | ask | show | jobs
by stingraycharles 1698 days ago
I’m a total cryptocurrency noob. Could you elaborate a bit further on what an oracle is in this context? I’m familiar with the term oracle in crypto for things such as a padding oracle, but I feel that what you’re referring to is a different kind of oracle.
4 comments

An Oracle is a way to tell the blockchain about external data like the price of something in the general markets. As I understand, a flash loan is a loan that is both created and paid in the same blockchain transaction (thus if it can't be paid it won't be included in the transaction), and that the exploit here was to both modify the price given by the oracle twice (up and down) and have a flash loan in the middle, all in the same transaction.

I hope I'm not adding to the confusion because I am not an expert.

that clears a lot up, thank you.

does the oracle in this specific case use external data? and combine that with internal / blockchain inputs? how does one sanitize all those inputs?

are oracles transactional, ie if you manage to alter the state of an oracle within a contract’s transaction, other transactions don’t get any “dirty reads” from the oracle, etc?

An oracle is just a provider of some kind of off-chain data. For example if I wanted to incorporate the stock price of AAPL in my smart contract I would need to "trust" some off-chain (and possibly centralized) provider of data to deliver that information to my smart contract.

The obvious problem is that if that data is manipulated somehow, the smart contract can potentially execute with malicious information.

What made it click for me was that smart contracts are similar to stored procedures in db speak.

So in this case someone wrote a smart contract/stored procedure that:

- loan $a_lot_of_money from $defi_a

- do something with $a_lot_of_money to confuse an oracle (e.g. a price feed)

- exploit $defi_b who relies on above oracle data

- return $a_lot_of_money to $defi_a

This all happens in a single "db transaction" so as long as $defi_a receives its money back the tx is going to pass.

If $defi_b relies on an oracle that takes it's data from on-chain, and thus is manipulatable with $a_lot_of_money, it is suspectible to those attacks.

To counteract this, $defi_b could only rely on oracles that are secure against manipulation from $a_lot_of_money, but they don't always exist.

This mechanism can be used for good (riskless arbitrage across decentralized exchange) or for bad exploits.

Others have answered, but there is a tool that helps with trusting oracle data, called Chainlink ($LINK)

Chainlink uses a proof a stake (POS) concept where it calls out to a number of LINK nodes that have staked assets for liability in order to win rewards. With all of the Oracles data it goes through an algorithm, for simplicity, let's say the average of all the prices it received, gives the nodes a reputation score, on top of that it uses the reputation of the nodes to choose who ultimately fulfills the request, the number of tokens staked will also take into account. If reputation starts going negative, they could lose the tokens they have staked.