2

I've created a private test net and can successfully connect to it from any machine. I can start mining there: miner.start() and eth.sendTransaction() from one account to another too. I can see, that last transactions belong to 2000th block.

So here comes first question: I propose, that all these blocks are stored in geth/chaindata/*.ldb files, right? I want to be able to revert net state to a certain block(or transaction better), so all the nodes will accept this backup.

(I thought the first solution could be deleting certain .ldb files on each node)

Second question: is kind of curiosity - what is being mined, when i do miner.start() and do not generate transactions??

1

From the geth console you can call debug.setHead to reset the local head.

I'd suggest to first create a new node, connect to the resto of the nodes, let is finish synchronizing. Then disconnect it from the other nodes, then calling setHead. Verify the blockchain is in the state you want.

When there's no pending transactions a PoW based blockchain will mine empty blocks to increase the security of the blockchain, longer chain means more security and lower probability of attacks to the chain.

  • That's interesting! Basically, if i tell all nodes in my private test net setHead(#block_i_want), will this backup the whole test net to this block? – Ladenkov Vladislav Feb 23 '18 at 14:43
  • That should work, but I'd make a backup, I never tried it with a running system with several nodes. – Ismael Feb 23 '18 at 14:48
1

In geth you have options for exporting and importing blockchain files.

geth help
USAGE:
   geth [options] command [command options] [arguments...]
COMMANDS:
   ...
   import      Import a blockchain file
   export      Export blockchain into file

Unfortunately there is no way to delete a particular block from what I know. You will have to export at different stages. You might be able to take that export file and remove parts of that file but I don't really know if there is a tool to do it.

  • Thanks for the info. Unfortunately, this does not help me so far – Ladenkov Vladislav Feb 23 '18 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.