I've created a simple script to read ethereum data from the leveldb using C++. Basically this testing program would print all keys in leveldb to the console.
#include <cassert>
#include <iostream>
#include "leveldb/db.h"
using namespace std;
// g++ leveldb_test.cpp -o test -lleveldb
int main(int argc, const char *argv[]) {
leveldb::DB* db;
leveldb::Options options;
options.create_if_missing = true;
leveldb::Status status = leveldb::DB::Open(options, "/home/user/.ethereum/rinkeby/geth/chaindata", &db);
if (!status.ok()){
cerr << status.ToString() << endl;
delete db;
return 0;
}
leveldb::Iterator* it = db->NewIterator(leveldb::ReadOptions());
for (it->SeekToFirst(); it->Valid(); it->Next()) {
cout << it->key().ToString() << endl;
}
delete it;
delete db;
return 1;
}
but the results are encoded like this.
How can I output a readable output? Is there a way to decode the ethereum leveldb data? (may be a c++ library?)