The State Oracle

The State Oracle is the newest addition to CENNZnet’s core module selection and brings with it a whole new exciting set of possibilities. Let’s dig into exactly what it is and how it can be used.
What is the State Oracle Module?
The State Oracle module works in partnership with the Emery token bridge to allow the CENNZnet network to view and read data from Ethereum. This means that contracts on CENNZnet can refer to data or activity on Ethereum and then use this information to trigger actions on CENNZnet.
What functions does the State Oracle bring to CENNZnet?
CENNZnet is a highly optimised L2 solution for Ethereum, this means that users and developers can use the speed and functions of CENNZnet while also relying on the mature security and tooling offered by Ethereum. It brings together the best of both worlds.
The State Oracle module adds another layer of interoperability between CENNZnet and Ethereum. Ethereum can be used as the state of truth which securely holds assets. DApps and Web3 projects can then run cheaper faster contracts on CENNZnet to put this data to use in fun and creative ways.
An exciting example of the State Oracle at work is the concept of composite NFTs, ie. one NFT made of many NFT parts. For example, a classic NFT avatars (e.g CryptoPunks, Avastars or Bored Apes) can be composed of distinct parts/tokens: a character, a background and items. Using CENNZnet’s State Oracle these composite NFTs could incorporate much more user flexibility, for example altering background, music and items quickly and cheaply.
To do this the main token (the character) would be stored on Ethereum while supporting tokens (backgrounds, music, items) and a mapping are stored on CENNZnet. The mapping shows which supporting tokens are currently active (being displayed) on the avatar NFT. Contracts could be run on CENNZnet to change which supporting tokens are active while the ownership of the whole NFT is verified on Ethereum.
So in essence with the State Oracle, the contract to alter the composite NFT can be run and executed on CENNZnet. The main part of the NFT is still securely stored on Ethereum but users can access more functionality by using CENNZnet’s superior speed.
Summed up the State Oracle means devs can bring together the:
- asset security of Ethereum, and
- fast contract and transaction speeds of CENNZnet
How does it work?
The State Oracle module uses a unique system to achieve an efficient and secure movement of data from one blockchain to another. The sequence goes like this:
- A contract on CENNZnet asks a question about the Ethereum network.
- The question is made public to the CENNznet chain so everyone in the community can see it.
- Community members running a relay service detect the question.
- A community member can choose to run a query on Ethereum, collect the answer and then respond to the contract with the answer (if they deliver the correct answer they will be rewarded with a small fee).
- If the rest of the relay community agrees this is the correct answer then it stays. If someone thinks it’s wrong they can challenge the answer.
- If a challenge is put forward, the CENNZnet validators take up the challenge and run a query on Ethereum to find the right answer.
- The validators deliver the right answer and fine the relayer who was wrong (challenger or answerer).
The service works by trusting the CENNZnet validators absolutely. There is no benefit to anyone incorrectly answering or challenging the question as they will simply be fined. This type of trust system is called an oracle as a cryptographic proof is not required to provide a trusted answer (aka cryptoeconomic security vs. cryptographic).
How can you use the State Oracle?
The state oracle will be available to all developers on the CENNZnet chain. When deploying a contract, devs will be able to include specific code to run the oracle. More details on this can be found on the CENNZnet GitHub here.