Aug 02, 2018 Ethereum’s trie data structure implementation is different than traditional trie implementations, as modifications have been made to increase the. How to Send Ethereum Transactions With Java. Compute its raw representation (in the Ethereum RLP format). It uses leveldb, and what I found out is that EthereumJ uses an outdated leveldb.
I wish to use leveldb in my pure C# project.
I have googled for a C# version of leveldb, but got no lucky.
Any one can tell me where I can find a C# version of leveldb?
Thanks
JackJack2,01377 gold badges3535 silver badges6464 bronze badges
closed as off-topic by Will, Will Eddins, Ed Bayiates, Tormod Fjeldskår, gunr2171Feb 3 '14 at 19:58
This question appears to be off-topic. The users who voted to close gave this specific reason:
- 'Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – Will Eddins, Ed Bayiates, Tormod Fjeldskår, gunr2171
4 Answers
Not that I know of, but I've been using it in my C# project. If you're familiar with C++, then you can make your own CLI wrapper (shouldn't be that much trouble), build it as a DLL and then you can load that DLL in your C# project like any other assembly reference.
There is a windows port for leveldb and it's a little tricky to get it into Visual Studio, but if you're having trouble I can upload my Visual Studio 2010 solution (which is 75% of the battle) with the whole thing set-up and ready to build (except the CLI wrapper). I can put it up on github or something, which I'm actually planning on doing anyway, but I'll expedite it for you.
Like I said, I've been using that approach for my C# project and it works great. However, if you have really high performance requirements, then I would recommend batching up 'work' in order to reduce the P/Invokes.
Example
Please note that I have not compiled this code, but I'm just posting it as an example. Your header file might look like this:
Your cpp file is going to be along the lines of:
This should get you in the right direction.
Get Example
OK, Get will look like this:
The source is along the lines:
Note that different data may have different encoding, so I feel like the safest way to pass data between your unmanaged and managed code is to use pointers and an
UnmanagedMemoryStream
. Here is how you would get the data associated with a key in C#:Again, I have not compiled or run the code, but it should get you on the right track.
KirilKiril29.3k2323 gold badges146146 silver badges209209 bronze badges
As much as I can see you could also use LMDB (lightning memory mapped database, http://symas.com/mdb/ ) which seems quite similar to LevelDB and also comes with a .Net wrapper(https://github.com/ilyalukyanov/Lightning.NET) Dont know how well it works though, haven't used it yet...
JacobJacob
Matt CruikshankMatt Cruikshank
I don't know the story here, but there's this project at Microsoft's official Rx-Js page here.
xanadontxanadont6,06966 gold badges2929 silver badges4646 bronze badges
Not the answer you're looking for? Browse other questions tagged c#databaseleveldb or ask your own question.
I put around 11K key&values in LMDB database . LMDB database file size become 21Mb.
For the same data the leveldb is taking 8Mb only (with snappy compression).
LMDB env info ,
TO check why LMDB file size is more ,I iterated through all keys & values insidethe database. The total size of all key & value is 10Mb.
But the actual size of the file is 21Mb. Remaining file size of 11Mb (21Mb - 10Mb) used for what purpose???!!.
If i compress data before put operation ,only 2Mb got reduced
Why LMDB database file size is more than actual data size?
Any way to shrink it ?
Community♦
Rajesh GopuRajesh Gopu
1 Answer
The database is bigger than the original file because lmdb requires to do some bookeeping to keep the data sorted. Also, there is an overhead because even if your record (key + value) is say 1kb lmdb allocates a fixed size of space to store those. I don't know the actual value. But this overhead is always expected.
Compression doesn't work well on small records.
lmdb doesn't support prefix or block compression. Your best bet is to use a key-value store that does, like wiredtiger.
amiroucheamirouche3,97466 gold badges3333 silver badges7373 bronze badges