Apr 1, 2022
4 min read
LevelDB — Invented by Google and used by cryptocurrencies like Bitcoin (₿)
What is LevelDb?
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. Apart from being open-source, it is written in C++ and was launched in 2011.
Moreover, LevelDB is an LSM-based key-value store that offers enhanced write throughput and reasonable read throughput. Essentially, LevelDB excels at random reads and writes.
How it is used by Bitcoin & Ethereum?
Before moving on that how does it uses LevelDB to store data, we first need to understand what are UTXO (unspent transaction output) in any cryptocurrency.
Let’s assume you receive 5 ₿ from your father, 3 ₿ from your mother and 2 ₿ from a shop keeper. You have 3 UTXO.
Bitcoin wallet balance = 5 ₿ + 3 ₿ + 2 ₿
In total you had 10 ₿. Now, you went to purchase a gadget which was priced at 6.98 ₿. Since you had enough Bitcoins, you transferred 5 ₿ & 2 ₿ for the gadget.
Bitcoin wallet balance = 3 ₿
Since, the remaining balance 0.02 ₿ was left. You get 0.01 ₿ back because 0.01 ₿ is deducted as the fee for the transaction. Now, you converted 3 UTOX to 2 UTOX.
Bitcoin wallet balance = 3 ₿ + 0.01 ₿
In general, Bitcoin could be any number instead of fixed numbers as we have in any currency like dollars. The minimum value it should be is 1 Satoshi.
Note: 100 million Satoshis == 1 Bitcoin
Let’s look how does LevelDb comes in picture.
When ever a transaction occur, we all know that basically every cryptocurrency is a blocks of chain or it can be assumed as ledgers.
Bitcoin works on mechanism of Transaction ledgers.
Ethereum works on mechanism of Balance ledges.
Crypto blocks just contain the relevant information about the transaction such as:
- Previous hash of the block.
- Merkel tree root hash.
- Spent transaction output hash.
- Etc, depending upon cryptocurrencies.
There are four pieces of data that are maintained
Among these lets discuss more about chainstate/* & blocks/index/*.
blocks/index/*: this is a LevelDB database that contains metadata about all known blocks, and where to find them on disk. Without this, finding a block would be very slow.
Chainstate/*: this is a LevelDB database with a compact representation of all currently UTXO’s and some metadata about the transactions they are from. The data here is necessary for validating new incoming blocks and transactions. It can theoretically be rebuilt from the block data, but this takes a rather long time. Without it, you could still theoretically do validation indeed, but it would mean a full scan through the blocks (398.37 GB as of 31 March, 2022) for every output being spent.
The LevelDB’s are redundant in the sense that they can be rebuilt from the block data. But validation and other operations would become intolerably slow without them.
Databases form an important part of an application stack, after the server and client side parts of it have been…
This page describes how & where Bitcoin Core stores blockchain data. There are basically four pieces of data that are…
Thanks for contributing an answer to Bitcoin Stack Exchange! Please be sure to answer the question. Provide details and…
LevelDB is an open-source on-disk key-value store written by Google fellows Jeffrey Dean and Sanjay Ghemawat. Inspired…
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to…
- What are the Trading Signals? | Bitstamp vs Coinbase | Buy Solana
- ProfitFarmers Review | How to use Cornix Trading Bot
- 10 Best Cryptocurrency Blogs | YouHodler Review
- MyConstant Review | 8 Best Swing Trading Bots
- MXC Exchange Review | Pionex vs Binance | Pionex Arbitrage Bot
Sign up for Coinmonks
A newsletter that brings you day’s best crypto news, Technical analysis, Discount Offers, and MEMEs directly in your inbox, by CoinCodeCap.com Take a look.
Get this newsletter
Coinmonks (http://coinmonks.io/) is a non-profit Crypto Educational Publication. Follow us on Twitter @coinmonks and Our other project — https://coincodecap.com, Email — firstname.lastname@example.org
*Please note that this article is not financial advice. Layer 1 smart contract platform Zilliqa’s native token ZIL rose almost 500% in price, from $0.045 to a high of $0.22. The token has since retraced to $0.18. …
Share your ideas with millions of readers.
Long term partnership begins with Metalandz and Hummingbird Finance on their decentralized platform, NestSwap — Metalandz, what’s it all about? Metalandz is a play-to-earn gaming platform based on the BNB Chain. Their vision is to offer a deeply immersive platform in which players will create their own non-fungible tokens (NFTs) and rewarding their participation with our governance and utility token — METAZ by playing Poly Jungle.
Your Monthly Brief into the World of Digital Assets — Article by Sixte C. Edited by Lesia M. Market Overview Open Interest Regulators Biden issues an Executive Order focused on cryptocurrencies European Union voted for a new regulatory framework on cryptocurrencies Swiss city, Lugano, will accept BTC, UST and LVGA as ‘de facto’ legal tender Financial institutions, DeFi, GameFi Why LUNA’s price rose 133% in two months…
LFG BTC plan | Market Update | EU Vote | NFT — Prepare the pitchforks; the battle for crypto never ends, and the community is preparing for a critical EU regulation vote that could shape the future of digital assets. In the meantime, the metaverse gets its first MetaUniversity, and is Do Kwon set to become the biggest bitcoin whale of all? …
VeriDoc Global is a patented verification protocol that can be integrated with any blockchain. The multichain solution currently leverages seven different blockchains. Each blockchain has its own unique strengths and weaknesses. VeriDoc Ledger is the seventh blockchain to be added to VeriDoc Global’s suite and was developed to fill the…