Cover photo

A Deep Dive Into Switchboard.xyz

Switchboard is a oracle network that has some advantages over traditional oracles

I'm relatively active on Solana, so I keep hearing about switchboard.xyz , mainly in reference to their potential airdrop and orb collecting campaign. I didn't really know what it actually was though, so I decided to find out what the big deal was. I discovered that they are a multi chain decentralized oracle network that has set some big goals. Switchboard wants to be the most secure, easiest to use, cheapest, and faster oracle in all of crypto. No big deal right? Although personally, I could probably create an ultra secure oracle network in my sleep, this is way more complicated for mere mortals to accomplish and Switchboard has put a lot of hard work into reaching these goals. That effort is starting to pay off as they currently are bringing in more than 20,000 dollars worth of $SOL a month in revenue and 4.3 million Solana transactions are going through Switchboard on a weekly basis from more than 13,000 unique users.

Switchboard is stacking some actual revenue unlike 90% of cryptocurrency projects

Now you may be wondering what an oracle even is, it sounds like some spirit or something that tells you your future. That would certainly be helpful, but that's a different kind of oracle! In crypto, oracles are vital pieces of blockchain infrastructure, without which dapps would have no way of accessing any data from outside it's own blockchain.

Not that kind of oracle

A war or other black swan event could pop off and the price of all crypto assets might drop 30% immediately (please God don't, I would get liquidated straight into a tent in the woods). Without a good oracle, a dapp might just continue to act as if your crypto is worth 30% more than it actually is worth, which would obviously cause a lot of problems! Switchboard On-Demand oracles are a special type of oracle, called a pull based oracle, that is unique in the way it handles data.

Me, post liquidation

A traditional push-based blockchain oracle handles data consensus on their own layer one blockchain before providing that data to users. This works fine for some use cases, but it has some major disadvantages. A push based oracle system node has to constantly acquire data from a data feed and publish it on chain, whether anyone is actively requesting that data or not. Every time it does this, a blockchain transaction is taking place, and the constant updating of data leads to lots of transactions, which means more fees and traffic. For example, even if the user only needs data every 10 blocks, they are going to be paying the cost for data to be updated every block. The advantage of a system like this is that it doesn't require any input from the end user, it will automatically collect and propagate data. However, this automatic pushing of price data onto the blockchain can cause quite a bit of congestion, and this is one of the reasons why Solana has been having congestion problems lately. When many users are using the same oracle, and that oracle is also pushing data whether it's needed or not, then you can get the blockchain version of a traffic jam.

Push based oracles lead to network congestion

Pull based oracles, such as Switchboard On-Demand, do not have many of the problems that push based oracles do. For example, Switchboard recognizes that each user may have unique needs and allows users to construct their own customized oracle. This is like having your own private bridge between the data feed and the blockchain when everyone else is trying to crowd onto the same bridge. These custom pull based oracles only use the blockchain on an as needed basis, which is cheaper and more efficient. Data is only driving across the Switchboard bridges when it actually is needed on the other side, whereas data is constantly driving back and forth on the traditional oracle bridge whether they are needed or not, burning lots of gas for no reason. If more of Solana's protocols start to use Switchboard, than those oracle data traffic jams can be alleviated.

Using Switchboard's On-Demand is kind of like having your own private bridge to data feeds

Now, how does Switchboard get data from a data feed to the end user securely and quickly? Well on top of the standard economic incentives to keep the different actors in the network from acting maliciously, Switchboard adds even more layers of security. The data begins it's journey within a TEE(trusted execution environment), which is an offchain secure enclave in which you can run a process or even an entire virtual machine (a computer within a computer). Imagine an underground bunker where a General and his staff are coordinating a war. Nobody is getting in there, but messages can still get in and out, and those messages are both private and verifiable. This is so you can verify that the message came from the General without revealing its contents until it reaches its intended destination. These messages from within the bunker (secure enclave), are called "enclave quotes". They are cryptographically signed so that anybody can verify with 100% certainty that they are indeed from the enclave and nowhere else.

Good luck getting into the secure enclave

This is all done using Intel's SGX (Software Guard Extension) tech, which is the same top of the line security technology that is used by Signal's encrypted messenger, Microsoft's Azure Cloud, and the Secret Network's private blockchain. By using SGX based hardware attestations, Switchboard can ensure that oracles aren't running any code other than what they are supposed to. Even SGX isn't perfect though, it does have certain vulnerabilities just like everything else, but Switchboard mitigates these vulnerabilities by making all it's guardians and oracles re-certify their certificates every week. It's like if the General double checks all of his staff members regularly to make sure no spies have infiltrated the bunker. The layers of security don't stop there though, Switchboard is also using confidential runtimes within the TEE to protect the data while its actually being processed. This adds a software layer of security on top of the hardware based security of SGX. A confidential runtime would be the equivalent of software on our General's command and control computer that prevents unauthorized access so that if one of his staff members was ever compromised they couldn't use that computer.

No spies allowed

Now why can't the data just go straight from the feed to the user without this complicated "TEE" and "SGX" alphabet soup? Wouldn't that be easier? Well imagine if your adversary could see your messages before your soldiers at the forward base can? They could plan accordingly, set an ambush, and slaughter all your men. Well with a traditional push-based blockchain oracle, your soldiers would be in danger, because they handle data consensus on their own layer one blockchain before providing that data to users. This works fine for some use cases, but it has some major disadvantages. The data takes longer to reach the user with this push based method of data propagation. The oracle operators also know the content of the data before the user does, which they can take advantage of at the user's expense. Let's say an oracle provider knows that once you confirm that the price of Solana has gone above 190, you are going to take a certain action. They now know what you are going to do before you do, because as soon as the price hits 190.000001, the oracle has a head start before it gives you the data confirming the price. They can then front run you and profit at your expense. Switchboard fixes this by processing data within those confidential runtimes, which prevents switchboard's oracles from being able to observe what data they are collecting before the end user can.

Switchboard prevents ambushes

After leaving the TEE, the next stop for the enclave quote is called a guardian. Guardians serve as the bridge between the secure enclave and the blockchain. Transporting the general's messages is a serious responsibility and not just anyone can do it! A guardian has to go through a thorough vetting process called Queue Authority approval before it is allowed to pass messages. The prospective guardian has to first submit an application to the Switchboard team, who then checks to see if they meet the minimum requirements to be a guardian. If their application is approved, it then has to be reviewed and voted on by the existing guardians. If they get enough votes, then they are on-boarded and are still evaluated on a regular basis to make sure they are doing their job effectively.

Not just anyone can be a guardian, you have go through a vetting process.

Now data can't just be thrown around willy nilly, especially on an oracle network with limited resources. It needs to be organized! That's what Switchboard's queues are for, they separate all the data feeds into different networks based on what kind of data it is, where it's coming from, and where it's going. It's like sorting mail, some mail needs to prioritized, and the mail has to be delivered to the correct place. After the data feeds have been sorted, users can pick the ones they need for their unique purposes. Based on demand for each data feed, Switchboard can scale horizontally, adding more resources wherever needed to ensure the data is delivered efficiently.

Not all messages are created equal

The guardians take these messages and give them to the actual on-demand oracles. The oracles act as a web service hosting a REST API to acquire and sign data. The oracle is what the actual user interacts with, when the user wants some data they can pay a small fee and the oracle will publish the requested data to the blockchain. A Switchboard on-demand oracle is composed of 3 components, the frontend, the router or gateway, and the worker. The frontend is kind of the like the security checkpoint at the forward base of the army, it controls who can come in and request to read messages from the secure enclave. The frontend is a public web service, so they have to control traffic or it might be overwhelmed by a denial of service attack. If they let just anyone come into the base, then it might just get flooded with people requesting data for no reason except to ruin their day.

The frontend has to control traffic to prevent denial of service attacks

Inside the base you can find the "router". You can imagine this as a command and control room full of computers and intelligence officers processing the actual messages from the enclave and assigning missions or "work" to different oracle workers in the most efficient way possible. Oracle workers are the soldiers who will actually carry out the mission and are the last stop for data before it reaches the user. They are chosen based on how well they have been performing, the size of their stake, whether they can pass a liveness check, and how much capacity they are advertising. If they lie about how much work they can handle, they will be punished or slashed, which incentivizes honesty. This way the router knows what each worker can handle and doesn't send too much work to any one oracle worker, preventing slowdowns in the network.

The router processes messages from the secure enclave and assigns work to oracle workers

As you can see, there are a lot of steps between requesting some data and getting it, and a lot of things can go wrong along the way. That's why Switchboard has designed its system to maximize security and efficiency in a way that just isn't possible with a traditional push based oracle system. Now that you know what Switchboard's On-Demand oracle service is and how it works, what are the advantages of picking Switchboard for your oracle needs?

Customizability: Custom oracles with the flexibility to fit a user's specific needs instead of inefficient and inflexible one size fits all oracles

Less Traffic: Using Switchboard causes less blockchain congestion which is good for everyone

Speed: Switchboard is like a formula one race car, other oracles are more like a gently used 2001 Honda

Switchboard is like a brand new race car, other oracles are a 2001 Honda

Fresh: Data from a traditional oracle might be stale or slightly out of date, unlike switchboard's data which is as fresh as spring flowers

Transparent: Users can choose which guardians serve them, so they know exactly who is handling their requests.

Scaleable and Efficient: Can scale up or down based on demand, ensuring resources are allocated as efficiently as possible

Cheap: Only pay for what you need, when you need it.

Developer friendly: They offer both a Rust and a Typescript SDK for developers and it's designed to be simple to integrate it into whatever you are working on.

Secure: The data is being processed in a way that is both secure and prevents abuse.

Composability: Individual data feeds can reference and build on each other.

Randomness and Secrets: Not just data is available, Switchboard can securely store your "secrets" such as passwords and API keys or provide verifiable randomness for an application.

And don't forget...Orbs!

After my research, I definitely believe switchboard.xyz has created an impressive oracle service that both addresses many of the shortcomings of a traditional oracle and has unique advantages that make it an important part of the ecosystem. Connecting a blockchain like Solana to offchain data sources in a secure and efficient manner enables all kinds of use cases, some of which we can't even imagine yet. Switchboard On-Demand is going to be an important building block for the next generation of Solana dapps, and if what they have accomplished already is any indication, then they are going to continue to improve the product and innovate in the future.

Thanks for reading my ramblings! This blog post was originally a Twitter thread and was 100% written by a human (that's me! well, I'm human on a good day anyways) and the images were generated by the new venice.ai which is a privacy respecting LLM that is backed by Erik Voorhees (the crypto libertarian behind satoshi dice and shapeshift). Please let me know what you think in the comments and subscribe if you haven't already.

Loading...
highlight
Collect this post to permanently own it.
Thought Crime Trap House logo
Subscribe to Thought Crime Trap House and never miss a post.
#switchboard.xyz#solana#infrastructure#web3#crypto#oracles