When most people think about Chainlink, they think about decentralized oracles. A blockchain oracle is any device or entity that connects a deterministic blockchain with off-chain data. When oracles bring off-chain data (price feeds, weather data, sports results, election results, IoT data, flight data, etc.) from the real word on-chain, they enable the execution of blockchain-based smart contracts across a growing number of use cases.
While smart contracts are already a landmark advancement in how people form and execute agreements based on math instead of trust, the overwhelming majority of existing decentralized applications (dApps) don’t venture outside of blockchain into people’s everyday lives.
This is the problem Patrick Collins, a software engineer and developer advocate at Chainlink Labs, set out to tackle by using a smart contract to order a Domino’s pizza. This experiment not only highlights how smart contracts can function in the real world; it shows how oracles work both ways. In addition to bringing real-world data on-chain to execute smart contracts, Chainlink’s External Adapters enable smart contracts to execute transactions in the real world.
“Oracles are actually directional. They can send data off and send requests; this is where external adapters come into play,” Collins said. “Oracles are completely customizable. You can bring any data in and any data out. External adapters can be extended to do virtually anything.”
Collins ordered from Domino’s because the multinational pizza restaurant chain has a relatively sophisticated digital infrastructure and an exposed API. To simultaneously showcase the potential of Chainlink VRF (Verifiable Randomness), which generates randomness that is verifiable on-chain, Collins created a smart contract application that orders a provably random pizza. (Chainlink VRF also powers Rare Pizzas, a collection of 10,000 provably rare pizza NFTs.)
“This was to demonstrate that smart contract prowess goes beyond blockchain but also to showcase the best functionalities of Chainlink at the moment – external adapters and VRF – to create a verifiably random pizza. I wanted to illustrate how people can use smart contracts to pay for anything or any service, from really smart stuff to really silly stuff.”
In short, the smart contract pizza ordering process went like this: Collins used Chainlink VRF to pull a random number and send it to a pizza creator function in an external adapter. Once the Chainlink node returned the response with the random number, it kicked off the API call to the chainlink node to generate and order the pizza.
So, what kind of verifiably random pizzas showed up at Collins’ doorstep? Perhaps the most “random” was a half cheese and grilled chicken/half “just the crust” hybrid that looked even funnier than it sounds.
However, some of the VRF pizzas were unexpectedly delicious. Collins, who ordinarily doesn’t go for banana peppers, was pleasantly surprised by how well they worked in concert with other randomly selected toppings.
Though there is room for improvement, the pizza project represents one small step in the journey toward a world powered by smart contracts. “The leap,” Collins said, “is that all of these smart contracts we have on-chain can be updated to do anything.” He sees smart contracts expanding beyond the world of DeFi, where digital agreements can be and do whatever people want them to – whether that’s calling a friend, executing an important legal document or ordering a truly unique pizza.
Watch the full VRF Pizza experiment on YouTube: