Intro to Layer 2 Data (L2D)

Layer-2 Data Feeds

Umbrella's Layer-2 Data feeds live on a Layer-2 network while the Umbrella Network contract allows developers and users to verify the cryptographic integrity of the data pulled from the Layer-2 data feeds.

Umbrella uses a Merkle Tree that is rolled up and anchored to Ethereum. Merkle Trees allow decentralized applications to scale without sacrificing security while maintaining data integrity. In our application, each leaf on the Merkle Tree represents a data point. The data point could be cryptocurrency pairs such as ETH/USDT or the price of Apple stock. The leaves are “rolled” from the lowest leaf up to the Root Hash. And the Root Hash is a unique representation of the entire Merkle Tree.

700

Merkle Trees allow decentralized applications to scale without sacrificing security while maintaining data integrity. In our application, each leaf on the Merkle Tree represents a data point. The data point could be cryptocurrency pairs such as ETH/USDT or the price of Apple stock. The leaves are “rolled” from the lowest leaf up to the Root Hash. And the Root Hash is a unique representation of the entire Merkle Tree.

Proving the validity of data is a unique property of a Merkle Tree. So in this instance, if I am given the internal data (key-value pair, block ID) along with the sibling hash, I can confirm the validity of the data.

625

The image above represents a Merkle Tree with 8 leaves (Kn, Vn). Leaves can be any data, in our case a pair of key and value. Each leaves data (combined key + value) is hashed and as a result, we get a unique ID hash (eg. H11).

Uniqueness is guaranteed by hashing algorithm; meaning, if we made any change to the data we will get a completely different hash. By hashing all data we just created the next level of tree — represented in the image as leaf hashes (H11–18). Now we join them into pairs and hash them together again — as a result we get the next level up on the Merkle Tree. Repeating this same process, we get to the Merkle Tree root: “The Root Hash” as shown in the image above. Because of the uniqueness of hashes, different data produces different roots. We are using this property to prove the data.

We store The Root Hash (or for simplicity, the “root”) on-chain. When we want to prove that K4V4 are valid this is what we do:

1.) We know the K4 and V4 so we can hash them and we get H14

2.) in order to get hash H22 we need to know the pair for H13, this pair item is called sibling and needs to be provided by Umbrella

3.) having H13 sibling and H14 we can calculate H22

4.) we repeat hashing with siblings until we get the root

5.) if the root that we got is the same as saved on-chain it proves that TX4 data is valid

Umbrella utilizes the unique qualities of Merkle Trees to make data available to dApps and Layer 2 applications. Umbrella provides the Key Value Pair, block ID, and the sibling proof which allows applications to confirm the validity of the data.

Umbrella Network's Visual Demo

This demonstration app is not meant to be used in production. It is purely to illustrate how Umbrella works and to give a visual representation. And so, this application will not show all of the cryptocurrency pairs, implied volatility, realized volatility and other data Umbrella’s Oracle supports. Umbrella is designed to be used directly from a smart contract or API.

The Umbrella Demo application can be found at the Umbrella website: https://demo.umb.network/

700

User would first select “Proofs” in the left menu bar. In the dropdown menu “Keys”, User can select the data points they would like to retrieve.

For the purposes of this demo, we are making only a few key pairs available. The live product will make thousands of data points available. In addition, this demo app only provides spot data feeds.

Once again, the live product allows for the retrieval of all historical data in addition to spot data.

User can then select the pair they would like to retrieve. In this example, we selected two pairs.

700

The data is automatically populated with the following:

-Key: the name of the currency pair
-Value: the price (or any other type of data that we supporting)
-Block ID: the internal block ID in our sidechain
-Proof: the hash of the sibling leaf
-Key [Bytes]: byte representation of the Key
-Value [Bytes]: byte representation of the Value

To verify that the values returned by Umbrella’s Block Explorer, the User can view the contract on Etherscan. This can easily be done by clicking on the green icon in the top right corner.

700

In the contract page, User copies and pastes the values from Umbrella’s Block Explorer into the corresponding section in “verifyProofForBlock”. Select “Query”. The result will be “Bool: true” if the key-value pair is consistent with what’s in the Merkle Tree and “Bool: false” if it is not.

700

If data is entered correctly, the result will be True as seen below:

700

If data is incorrect, the result will be False. In this example, we changed the value (bytes) by 1 digit from 0x0190 to 0x0191. And as expected, the returned value is “false”.

700

We hope this peek into the Umbrella oracle system provided you with a hands-on experience with how the system works and why it is unique. In one single Ethereum block, Umbrella is able to write hundreds if not thousands of data points thereby increasing the amount of data that is available on the chain while simultaneously reducing the cost of getting data on the chain.


What’s Next