3

I know Ethereum uses leveldb. When I checked into EOS I could not find that much out. I thought when I tested I did see leveldb.

Can someone confirm how the immutable data is stored?

EDIT

I think people may be misreading my question.

In Ethereum, LevelDB is used to store all the blocks as they are built. This therefore provides a history. If I want to know what were the older values of a variable, I could check in LevelDB.

It seems people have misread my query to be what dbs are supported by EOS?

EOS must be storing data somewhere which would be then open to queries. Hence someone can find out how a variable changed. Otherwise they will just see a variable value. The whole point - in my view - of using a blockchain is that we can see the old values. This is a sort of audit.

Therefore, my question is how would I query a db in EOS to get the old values of the state variables?

0

4 Answers 4

1

As the writing of this, EOS supports MongoDB out of the box. Storage is pluggable, so one could add LevelDB if needed.

Why doesn't EOS use other database?

Will EOS Storage support only mongoDB or even mySQL, postgreSQL, Redis etc.?

1
  • 1
    I will amend the question. I think people have misread it. Commented Oct 15, 2018 at 6:30
1

The way to store block data in EOS is different from that of Ethereum.

Ethereum uses Merkle Patricia Trie (MPT) to store all states (balances), and keeps its root hash in block header. When a change occurs in state, Ethereum creates new node containing new state and adds it to MPT. An outdated node, eg. having previous balance, is removed from MPT, but still remains in LevelDB. This might be your saying old values.

However, EOS uses chainbase, self-implemented data store with boost::multi_index, and it updates state directly rather than creates new state node and refer to it. Thus, you cannot find old values from chainbase. If you want to make a query to old values, you should construct your own DB which keeps all previous states.

To tell the truth, old values aren't necessary for an audit. You can reproduce all states at any specific point by replaying transactions from genesis block.

0

If you are asking how eos store data, contract data stored in ram as multiindex table , EOS USE BOOST MULTIINDEX .this is how you query on data . follow this article

david-grs.github.io/why_boost_multi_index_container-part1

1
  • My query is only how to confirm history, when I tested in ethereum there is a lot of chaindata which has all the blocks. As state changes we cannot see from the contract the history. I read your multiindex link. I cannot really see from that the underlying datastore. Here is a link about ethereum and leveldb - medium.com/cybermiles/… - see the chaindata directory. Commented Oct 17, 2018 at 9:22
0

No, LevelDB is not used in EOSIO.

You may want to check State History Plugins (SHiP) documentation on the Developer Portal:

From the Developer Portal:

The state_history_plugin caches blockchain data into files and is useful for obtaining historical data. The state_history listens on a socket for applications connecting to the state history plugin and send the blockchain data to the application.

Please note that MongoDB plugin is announced to be deprecated as of EOSIO v1.8.0-rc1 https://github.com/EOSIO/eos/issues/7597. SHiP is recommended instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.