HOW TO STORE DATA ON ETHEREUM BLOCKCHAIN?

Page 1

Copyright © Blockchain Council

www.blockchain-council.org

1


How To Store Data On Ethereum Blockchain? Since 2009, we have heard a lot about Blockchain, its application, and growth. There are some positives and negatives to this technology. But, one common thing is that this technology is growing at a faster pace. When we talk about Blockchain, then there is another parameter that we should not, and that’s data storage.

Copyright Š Blockchain Council

www.blockchain-council.org

2


We all know that Blockchain is a ledger which allows the exchange of information and this information is stored in the ledger. Well, our focus in this blog would be on Ethereum. It is not just a cryptocurrency, and there is much more to it. Till now we had discussed use cases of Blockchain, but here we will talk about data storage on Ethereum Blockchain.

Copyright Š Blockchain Council

www.blockchain-council.org

3


Ethereum Blockchain Ethereum is an open source Blockchain platform that allows the creation of decentralized applications, and It is a distributed public blockchain network. Ethereum Blockchain focuses on providing a platform for seamless running of codes for any decentralized application.

Copyright Š Blockchain Council

www.blockchain-council.org

4


Unlike Bitcoin, Ethereum Blockchain allows the miners to work to earn Ether. Ether is a token that will enable the entire system function. In the Ethereum blockchain, there is another type of token which is used to pay the miners; it is known as gas. Every smart contact for its execution requires a certain amount of gas to be sent to the miners to put it in the Blockchain.

Copyright Š Blockchain Council

www.blockchain-council.org

5


We all know a lot about the smart contract and how do they function. These preprogrammed contracts have a certain set of conditions agreed between two parties, once the conditions are met, the contract executes, and the processing of payment takes place. Now the question that arises here is how does the backend operation perform here.

Copyright Š Blockchain Council

www.blockchain-council.org

6


How is Data Stored In Ethereum? The data on Ethereum Blockchain is stored using tire data structures. Before going ahead, we would like you to know that it is completely sensible that permanent data like mined transaction and temporary data like account balance should be stored separately. Ethereum makes use of this trie data structure to manage temporary and permanent data. We can say that Ethereum is like a bank.

Copyright Š Blockchain Council

www.blockchain-council.org

7


Only after a transaction is confirmed, then it is recorded in the transaction trie. Ephemeral or temporary data like account address is stored in the state trie, and it changes and gets updated. Thus it makes complete sense to keep both temporary and permanent should be stored separately and hence we have three tries for managing and storing data.

Copyright Š Blockchain Council

www.blockchain-council.org

8


Detailed Description As mentioned above, Ethereum stores and manages data using a trie. There three types of the trie in the Ethereum Blockchain: ·

State Trie

·

Storage Trie

·

And Transaction Trie

Copyright © Blockchain Council

www.blockchain-council.org

9


State trie You must know that there is only one State Trie, Global State Trie in Ethereum. It gets constantly updated. The state trie consists of a key and value for every account which is present on the Ethereum account. This key is a 160-bit identifier.

Copyright Š Blockchain Council

www.blockchain-council.org

10


Storage trie As the name itself indicates, storage trie is where the contract data is present. Every ethereum account has its storage trie. 256-bit hash of the storage trie’s root node is stored in the global state trie as storageRoot.

Copyright Š Blockchain Council

www.blockchain-council.org

11


Transaction trie Every Ethereum block has its transaction trie. Every block contains transactions. The order of the transaction present in every block is based on the course of addition of transaction to the block. The position of the block never changes, the path of a particular transaction is via the index of where the transaction sits in the block. In simple words, it means, that you can locate transaction you can go back on the same path again and again and get the same result.

Copyright Š Blockchain Council

www.blockchain-council.org

12


An important point to note here is that data like account balance are not stores directly in the blocks. Only the root node hashes of the transaction trie, recept trie and state tries are stored in the Blockchain.

Copyright Š Blockchain Council

www.blockchain-council.org

13


Conclusion Ethereum Blockchain functioning is fairly simple, the division of permanent and temporary data in different tries ensures that data is safe and the data is easily manageable. The data stored on blockchain as smart contracts are safe and easy to access.

Copyright Š Blockchain Council

www.blockchain-council.org

14


Blockchain Council Certifications You can check out our certifications, and kick start your career in the Blockchain space today. ● ● ● ● ● ●

Certified Blockchain Expert Certified Blockchain Expertv2 Certified Blockchain Developer Certified Smart Contract Developer Certified Solidity Developer Certified Ethereum Developer

Copyright © Blockchain Council

www.blockchain-council.org

15


THANK YOU! Any questions? You can mail us at hello@blockchain-council.org Copyright © Blockchain Council

www.blockchain-council.org

16


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.