Probe to Mars

Beyond the Blockchain

tl;dr;

  • StarkWare has a set of software tools that allows for the creation of cryptographic proofs that attest to the computational integrity of the execution of a computer program
  • Cryptographic proofs enable regular computers (ex. a laptop) to keep supercomputers in check
  • Blockchains guarantee computational integrity by replying the same transaction over and over
  • Although used to create an Ethereum layer 2, this technology can be used outside of the blockchain as well
  • This technology can be the tool of choice for Enterprises

Cairo is a programming language created by StarkWare that has the unique property that a cryptographic proof that attests to the “integrity” of the computation can be derived from the execution of any program. Ok that was a mouthful, let’s unpack what it means.

Computational integrity means that if I give you a computer program to run for me, you will execute it exactly as it was defined in the source code and that neither you, a virus in your computer or faulty hardware in your machine has altered the execution and hence the result.

Let me give you an example of why this is important. Imagine you are the head of a space exploration agency of a smaller country and you are tasked with launching an unmanned spacecraft to Mars. One of the many challenges your scientist and engineers will have to solve is to pick the right launch window and to define the correct trajectory of the spacecraft to arrive at the red planet using the least amount of fuel.

Mars Launch Window
Shorter distance means less fuel and smaller rocket

After months of work your engineers develop a computer program that calculates both variables but it’s so complex that it requires the use of a supercomputer. Unfortunately such a computer doesn’t exist in your country so you are forced to rely on the supercomputer of a rival country that has stated its willingness to collaborate with your agency.

Weeks after you have provided the computer program to be executed, the rival country comes back with an answer for launch window and trajectory but you are suspicious. How do you know if the result is correct? How can you be sure that the supercomputer didn’t suffer a malfunction and changed a bit here and there by mistake? How can you verify that a rival spy agency didn’t mess with the execution of the program to give you a slightly modified result that could have disastrous consequences for your country’s space program? Normally you can’t but this is where StarkWare’s suite of tools can help.

Trusting your Rival
Normally it is not possible to verify the integrity of the computation

StarkWare’s Tools

Let’s rewind the clock and this time when your engineers are implementing the algorithm in code they will be using the programming language developed by StarkWare, Cairo. In order for the supercomputer to run the code they will have to use Cairo OS which not only performs the required calculation, it also creates an execution trace that can be used by another of StarkWare’s software tools, the “Prover”.

The Prover takes the execution trace and creates a cryptographic proof that attest to the integrity of the computation performed by the supercomputer. This cryptographic proof is relatively small in size and can be verified by another StarkWare tool called the “Verifier”. The key here is that, instead of trusting the result of the computation performed by your rival’s supercomputer, you can take the proof provided by them as a result of executing your code, run it through the Verifier software installed on a computer you control and have complete certainty that the result provided by your rival is correct (in the sense that it truly is the result of executing your code, not that your trajectory algorithm was right).

If there was a problem with the supercomputer hardware, if someone tried to modify the source code of your program or tried to mess up its execution, your Verifier would be able to spot the problem as the provided proof would be rejected. You wouldn’t be able to know exactly what happened but you’ll know that you can’t trust the result.

The proof can be verified with a regular computer

Let’s recap some of the prerequisites from your side for this to work:

  1. You need to write the program using Cairo
  2. You need to run the Verifier software on a normal computer (a laptop for example) you control

With this setup and technology you no longer have to trust your rival to do the right thing, you can independently verify the provided result without having to execute the computation yourself. You are able to use a laptop to keep a super computer in check.

The Blockchain

StarkWare provides a mechanism to verify computational integrity using cryptographic proofs. This proof is so small and easy to verify, compared to the underlying computation, that a regular computer can perform the verification.

The creation of the proof on the other hand is very taxing and it might require similar resources to the execution of the program itself. In our story, the supercomputer might need to work twice as hard in the second scenario where a proof is provided compared to the first scenario when the other party is simply asked to trust.

StarkWare’s technology is not the only mechanism in existence to guarantee computational integrity. Blockchains are also able to make such guarantees by simply replaying the same transaction independently on every single node of the network.

Computational Integrity by Replay
Computational integrity by replay

On Ethereum for example, when you execute a transaction you are asking a miner to run a particular program known as a “smart contract” and to store the result on the blockchain. When the block that contains the transaction is mined, it is then shared with a network of thousands of computers that will re-execute the same transaction to verify if the result posted by the miner was correct or not. The computational integrity of Ethereum as a global computer is achieved by replaying the same transaction in multiple machines and agreeing on the correct result by majority.

Achieving computation integrity by replay is very effective but also very inefficient. One of the reasons you have to pay a fee to execute a transaction on Ethereum is because you are renting multiple computers to re-execute the same transaction for you to guarantee its computational integrity. The more complex the computation is, the higher the fees you have to pay. If the computation is truly complex it might not be performed at all as Ethereum imposes a limit on how much computer power you can use in order to keep the network decentralized.

This is why StarkWare’s technology (and other technologies based on zero knowledge proofs) is so useful, you get the same computational integrity guarantee that a blockchain can give you but without the overhead of asking every single node on the network to execute the same program. Only a single computer executes the program and creates a proof.

Computational Integrity by Cryptographic Proof
Computational integrity by cryptographic proofs

A Hybrid Approach

If you have been following along with my articles you know that StarkWare is also the company behind StarkNet, an Ethereum layer 2 technology. If cryptographic proofs solve computation integrity in a more efficient way than the blockchain, why did StarkWare even bother to develop an integration with Ethereum?

If you remember the prerequisites of our original example of the Mars expedition, both you and your rival needed to have access to the source code and you were required to run a Verifier software on a computer you control. With StarkNet, the code to be executed would be publicly available for anyone to see (and run) as a smart contract on the blockchain. Instead of asking for a particular person to run the code for you, you can start a transaction and any supercomputer can pick up the task and provide the proof for a fee. Instead of having to personally verify a proof running a Verifier node, the proof is submitted to a Verifier smart contract on Ethereum where every single node performs the same cheap verification for a fee as well.

StarkNet's current architecture
StarkNet, an Ethereum Layer 2

With this blockchain version of the same technology, you can ask the engineers of your space agency to submit the computer program written in a version of Cairo tailored to StarkNet, and start a transaction every time you want to run the computation. On StarkNet you are not limited by the complexity of the computation as you are with Ethereum and only a single computer will execute the program. Once the proof has been created and submitted to the Verifier smart contract on Ethereum, you can query its status to know if the requested computation on StarkNet was performed with computation integrity and that the result is correct.

Conclusion

This might all seem like magic but the examples discussed above are possible today thanks to significant breakthroughs in cryptography that have been in the works for decades. One of StarkWare’s co-founder (Eli Ben-Sasson) has been part of this research so it’s no surprise that they are the first company to make a useful product out of it.

Zero Knowledge proofs are one of the most exciting technologies today and we are just beginning to explore how to harness its power. So far it is clear the implications in privacy or blockchain scalability but much more is to come. Gaming is another interesting area where these technologies are having an intriguing impact as for the first time the core logic of a game and even their physics engine can be put on a blockchain for anyone to use and integrate into new experiences. 

StarkWare’s technologies can be used outside of the blockchain too and I suspect that it could be a tool of choice for enterprises who, despite needing to work together, don’t trust each other and want to keep some information secret. In the open blockchain collaboration is possible but comes at a high cost and nothing is ever secret.

2 thoughts on “Beyond the Blockchain”

  1. Felicitaciones David, es un artículo muy interesante, nos pones al día en los nuevos avances de la tecnología computacional de manera muy sencilla y didáctica

So, what do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.