planetarium / libplanet

Blockchain in C#/.NET for on-chain, decentralized gaming
https://docs.libplanet.io/
GNU Lesser General Public License v2.1
506 stars 142 forks source link

Add `planet block` command for querying #1285

Closed longfin closed 3 years ago

longfin commented 3 years ago

It would be great if we can query block information via planet block subcommand.

kfangw commented 3 years ago

IMHO, there are 2 alternatives for this requirement.

Could you guide me? @longfin

kfangw commented 3 years ago

I am not familiar with rockdb. So I am afraid that it may not possible for the command that reads the DB held by the active node. If then, the second option can be used only for debugging purposes.

So I would like to implement the first option first. Is it OK for you?

longfin commented 3 years ago

IMHO, there are 2 alternatives for this requirement.

  • query to the active node(which has full data for the blocks) and return the result
  • parse the store(which is based on the file that is located in the same machine) directly and return the result

Could you guide me? @longfin

I've intended second option.

I am not familiar with rockdb. So I am afraid that it may not possible for the command that reads the DB held by the active node. If then, the second option can be used only for debugging purposes.

So I would like to implement the first option first. Is it OK for you?

IMO, you don't need to manipulate RocksDB directly because we're using IStore abstraction to fetch data from physical storage. (see also https://docs.libplanet.io/0.11.1/api/Libplanet.Store.IStore.html)

kfangw commented 3 years ago

Thanks for your kind explanation. :) I will be working on implementing the second option first by using the Store interface.