Why does a private blockchain need mining?

+2 votes
Mining is still a murky concept to me. Mining, as I understand it, is used to verify and secure unconfirmed transactions. Based on what I've read, for Bitcoin it seems to mean that when a transaction occurs it is unconfirmed until a new block is verified. My assumption has always been that the block is not "written" until both unconfirmed transactions are in the queue AND a block has been "mined" with a bundle of unconfirmed transactions.

I have a small use case where I think a private blockchain would be useful but I can't address a potential problem that mining might create. My client owns three stores that redeem vouchers produced by a government entity. Each voucher has a unique id that can only be redeemed once. I wrote a traditional web app with a centralized database that among other things keeps track of whether a certain voucher has already been redeemed or not in order to prevent fraud.

This works fine until the internet connection goes out. It's infrequent but wreaks havoc when it occurs since the cashier can not start a new transaction. I know there several different ways to address this issue but after downloading multichain it seems like an elegant, fault tolerant solution despite the fact that this use case doesn't meet all the requirements outlined in "Avoiding the pointless blockchain project" blog post.

The reason why I ask whether mining is necessary is that after completing the "getting started" example, it seems as if once you start mining it continues despite having no transactions to confirm. In my current use case, we try to minimize client hardware costs which includes minimizing the size of the hard drive and the "ghost mining" seems to just take up more and more hard drive space for no current purpose.

I know you can change the difficulty of the hash that needs to be solved so blocks are mined less frequently but is there a setting where mining only occurs when an unconfirmed transaction is present? While acknowledging ignoring one of the most important features of a blockchain and maybe its applicability, do you need mining at all in this use case?
asked Dec 7, 2015 by choiway

1 Answer

0 votes
 
Best answer

Thanks for the question. We've thought about adding this as an option - only generating a new block when there are transactions to place in it. But right now there are a few timing-related things that depend on block numbers increasing steadily at all times - the setup phase (which is defined in terms of the first blocks) and also temporary permissions settings which persist only for a certain block range. 

For now can I suggest changing the blockchain parameters to set target-block-time to a much higher number of seconds, and then make sure you use a parameter of minconf=0 for various API calls, i.e. so you can get balances and the like without depending on confirmations in blocks.

answered Dec 7, 2015 by MultiChain
Thanks. Another basic question: does a block only contain one transaction while the size of the block determines how much you can save to that block? I ask so that I can set the target-block-time based on an estimate of transactions.
Yes, the maximum block sizes determines how many transactions can go into each block, so the effective overall transaction rate. In general in a private blockchain unless you're concerned with spam, there's no reason to set the maximum block size to anything low.
Wouldn't minconf=0 allow double spend?
If all your full nodes are run by trusted entities, they will not allow a transaction to be propagated, if it conflicts with one they have already seen. This is true even before the transaction is confirmed in the blockchain.
...