G
G
Gudsaf2017-11-25 23:40:23
Node.js
Gudsaf, 2017-11-25 23:40:23

How to view raw Ethereum blockchain on local chain (+ my attempts)?

Actually, I launched a private ether blockchain according to the instructions , one might even say - local, because I'm the only one there and the accounts are all for the sake of appearance. I did the initial launch through geth, he created the chain for me, he saved it for me, he also mined the ether for me there for the sake of appearance.
Geth placed a local blockchain on a laptop, in a special dedicated folder, I have it at the address (I use a Mac):
/Users/Ololo/EthereumTestNet/geth/chaindata
Actually chaindata, the folder contains files that represent the blockchain database, as I understand it, reading foreign literature. This folder is the LevelDB database, which contains the following files:

  • 000002.ldb
  • 000003.log
  • CURRENT
  • LOCK
  • LOG
  • LOG.old
  • MANIFEST-000004

Here in these files, I repeat, as I understand it, that cherished chain is the contents of which I want to view. Actually, the first thing I tried was to open the file 000002.ldbwith notepad, it crashed: everything is encrypted there. I thought the problem was with the encoding. I found several DBMS that can work with LevelDB, it also turned out to be a fiasco: someone did not understand anything, someone did not open it, someone said "give me a password to decrypt".
Googling, I found out that everything is not so simple, and the contents of the chain are encrypted using the RLP algorithm. In the same place where I was informed about this, they suggested that there is a levelup module for Nodejs that can open the LevelDB of the ether database and actually decrypt the records. So I got instructions on how to do it. In the above example, everything is as you want - there is a chain, we opened it, read it, everything is fine. However, the success was hidden in the fog of problems: it didn’t work to open the database in this way: my similar second in the example line of code:
var db = levelup('/Users/Ololo/EthereumTestNet/geth/chaindata');

exited with an error InitializationError: Must provide db. I tried to play around with the paths to the database, but I got the notorious InitializationError: Must provide db- nothing helps. In general, I am exhausted.
What to do?
Has anyone already used Nodejs to read the raw chain?
Maybe there are easier options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gudsaf, 2017-11-26
@Gudsaf

Everything is fine, I achieved what I wanted:
Instead of:

var level = require('level')
var db = level('/Users/User/WebstormProjects/untitled/bin/chaindata')

necessary:
var levelup = require('levelup');
var db = levelup('/Users/User/WebstormProjects/untitled/bin/chaindata');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question