nearprotocol

Is there any way to inspect the contents of the RocksDB instance used by NEAR Protocol?


Disclosure: I work with NEAR and am currently on-boarding.

When I start up a local node on a clean machine I see that a .near folder is created in my home directory with a few configuration files (exact files seem to depend on which start_ script I run). Another folder appears inside of the .near folder called data.

Running strings ~/.near/data/*.sst in the folder spits out a few lines starting with the string "rocksdb" which led me to this reference to RocksDB

Is there any way to inspect the contents of a node's RocksDB instance?

I found Keylord but it crashes when I try to configure a new connection to the database (by pointing the connection to ~/.near/data). I didn't pursue that thread.

PSA1: sometimes it's useful to backup the ~/.near folder between node restarts if you want to reset the environment or avoid reusing old data while troubleshooting

mv ~/.near ~/.near_`date +%Y-%m-%d.%s`

PSA2: on MacOS you can watch what happens to the contents of the ~/.near folder while the node boots up and runs. (brew install watch).

watch -d -c -n 0.5 find ~/.near

Solution

  • The content of RocksDB is serialized using our own binary serialization format (http://borsh.io/), so you won't be able to examine the content with general-purpose third-party tools