4

I understand "oracles" in blockchain lingo refer to pieces of software that connect a smart contract chain like Solana to some "real world" data.

I am trying to wrap my head around how this can/will actually be accomplished.

All that Solana programs can do, is literally [1] execute BPF (i.e. they cannot access anything outside Solana), and [2] access Solana accounts, which are also inside the Solana world, and not connected to the outside world.

Let's take an oft-cited example for an oracle, a weather oracle. Using a weather oracle, I am supposed to be able to query, from my Solana program, what the temperature was at San Diego International Airport on July 24, 2022, at 4:00:00pm PDT.

How does that work?

I can only read data from Solana accounts, right? Not from the oracle's account. Not from any Chainlink (a leading provider for oracles) account.

So I assume there has to be another Solana program that we trust for some reason, that writes the weather data into a Solana account so that I can read it from within my own Solana program.

Then... Why do we trust this program, without breaking the point of running on a decentralized blockchain?

I assume it could either be a centrally controlled program that we just have to trust (pretty much the same way we have to trust AWS, Chase Bank, etc).

Then I'm thinking: There could also be a decentralized network (blockchain of its own) that collects weather data from multiple sources, and validates that information just as any other blockchain does, e.g. with PoS and votes.

Then that chain (let's call it the "weather chain" for now) would have weather data that is validated in a decentralized way.

But then, the data still has to make its way from there into a Solana account.

How can we make it verifiable that what ended up in the Solana "weather" account(s) is actually the data that was verified by the "weather chain" validators?

Maybe the answer is quite simple, but I can't really figure out an easy way, from the top of my mind, to "connect" these two chains without loss of decentralization, censorship-resistance, etc.

Any hints greatly appreciated.

1 Answer 1

3

Your best bet would be to check out Pyth's doc, as the leading price oracle on Solana.

The general idea is that (whitelisted) publishers can publish the price of an asset, along with a confidence interval, to the on-chain Pyth program which takes care of aggregating these data points into a single, aggregated estimate persisted to a Solana account, aka "price feed". Consumers can then choose to refer to this price feed in their own program by providing the relevant feed account.

Your question is really about trust and decentralization, so here are the relevant facts I see for the specific case of Pyth:

  • Pyth does use a network of ~60 publishers to diversify the source of the data,
  • you trust Pyth (1) to do what they claim since it is closed-source afaik, and (2) not to go rogue as much as any other mutable program on Solana (whole other debate so remaining light on that),
  • Pyth is not its own blockchain but is designed around a mechanism which allows anyone to submit claims if they judge a feed is erroneous. A process then gets triggered to gather data + identify the source of the divergence, before slashing the culprit's staked tokens if found to be wrong (publishers need to stake as collateral for publishing/incentive to play ball).

So afaict the trust for a consumer would come from that incentive/slashing system.

2
  • Thanks for the great answer, @man0s. Do you know if any example where the "real-world data" (such as weather in my example) comes form another blockchain, that is then linked to Solana or other smart contract chains? I would be very keen to learn more about how that works. Commented Jul 26, 2022 at 4:17
  • Unfortunately no, sorry!
    – man0s
    Commented Jul 26, 2022 at 4:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.