1

If I use a command geth --cache=1024, how many blocks it will hold runtime in cache. And what will be the size of each block. Is there any calculation? And is there any way using which we can force to write the data present in cache to leveldb files.?

2

I found this explanation from a reddit user and thought it will be useful to you in order to understand some things.

Ethereum has a gas limit rather than a block size. The gas limit is a cap on both processing and storage/bandwidth because the cost of a transaction/function is fixed in units of gas for each type of instruction.

The gas limit is voted up or down by each miner and each miner determines what gas price it is willing to accept which is like bitcoin transaction fees but on a per gas basis rather than a per transaction basis.

To figure out how many transactions can fit in a block you dont need to know what the price of gas is. You just need to know how much gas a transaction uses and divide the gas limit by that.

If the network receives a load of spam transactions that start filling up blocks then miners have 2 choices. They can vote up the gas limit to fit in more transactions or they can start increasing the gas price and reject transactions that pay too low a fee. Like with bitcoin a transaction with a low fee might still get through but it would have to wait until a miner that accepts a lower fee (lower gas price) is willing to let it in.

With a sustained spam attack it would just getprogressively more costly to do transactions until either the spammer runs out of money or the miners make so much money that they start expanding the network capacity...

All that this user says is true, and it's very well-explained.

As you see, it works quite different from Bitcoin scheme.

EDIT I leave here the reddit full discussion about that

Hope it helps.

  • 1
    That's a nice explanation, and totally true, maybe add that the link to let us get extra info please. – Kevin J. May 23 '18 at 12:02
  • one more thing I want to know that when the blocks will get written to the disk ? because when I killed the node using kill -9 <processId> at block height 1000 and then started the chain again, but it did not start from the height 1000. so If my chain gets killed, how to prevent the data loss? And Is there any way using which I can explicitly write the cache data to disk? – FLASH May 23 '18 at 13:14
  • The data loss can be prevented by having various nodes. This makes that at least one of them can continue recording the blockchain state. And knowing that for example on ethereum there are more than 20000 nodes, it's quite difficult that all of them crash at the same time and then have data lost. Add that if the answer was correct for you, mark it as it in order to help other users to reach it easily. – CPereez19 May 23 '18 at 13:59
  • Yes. but whenever cache gets full, blocks will be get written to disk, and we will have the empty cache again. right? – FLASH May 25 '18 at 8:30
  • Caches can also write and read data consinuously, the objective of them is to never get full, because if they are full and a new data block arrives, it'll be lost fs the process time of the cache isn't as fast as it needs to be. – CPereez19 May 25 '18 at 8:40

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.