These are my notes of the ninth lecture from Coursera’s Bitcoin and Cryptocurrency Technologies during Dec 2016 – Feb 2017. The lecture answered quite a bit of my questions regarding mining. Prior to this lecture, I knew that people mined by doing some heavy computational. Now, after learning about the background regarding incentives, it actually seems more reasonable. I was most shocked to realize that there will be only 21 million bitcoin create ever unless people change the rules.
Questions answered in this Post:
- High level, how does incentives help?
- What are block rewards and how does the reward gained change?
- What are transaction fees and how do they change?
- What is PoW and PoS and not Prisoner of War and Point of Service?
- How frequently are block created?
- What is a nonce? How is it used?
In the previous section looked at the consensus algorithm.
This lecture discussed a second part of Bitcoin’s decentralization called incentive engineering. What does this incentive engineering mean besides sounding like fancy name for treats?
Previously, it was discussed that there was a assumption that at least 50% of the nodes were honest and that one is able to pick a random node. Also, we would know if there was a Sybil attack as each of the nodes created by the Sybil would still be tracked to only a single user.
Assumption of honesty is problematic especially if there is financial incentive to subvert the system. Since nodes don’t have identities, one is unable to penalize the group that creates the malicious blocks.
Can we reward the blocks on the long standing chain? Yes. Use BitCoins to incentive the nodes that created these blocks
Two Incentive Mechanisms in Bitcoin
Incentive 1: Block Reward
Simply, you get bitcoin for creating a block. The amount of bitcoin you get changes over time. Actually according to < href="http://www.bitcoinblockhalf.com/">BitcoinBlockHalf. The coin reward is currently 12 and it will drop to 6 in 2020.
The block creator only gets to collect the reward only if the block ends up on the long-term consensus branch! Thus one is incentivized to behave honestly and to agree.
There is finite supply of bitcoin: 21 million
Block reward is how new bitcoins are created
Runs out in 2140. No new bitcoins unless the rules will change
Incentive 2: Transaction Fees
The second way is via transaction fees. This mechanism made more sense to me given that when you trade at least on financial markets you have to pay some amount for the processing. Thus the nodes who are doing this service can choose to take some amount for doing the transaction. From looking at things like Ethereum with gas, this is used as well and there exists a market value to see what the transaction price should be set as. If you give more than your transaction will be picked up faster.
Remaining problems
Then he started talking about something called Proof of Work. That peaked my interested since almost every bitcoin blog/youtube channel talks about this versus Proof of Stake.
Proof of Work
This is supposed to answer how to select a random node. The node will be selected in proportion to a resource that nobody should be able to monopolize on it.
Proof of Work – resource for giving nodes power is computing power
Proof of Stake – resource for giving nodes power is currency ownership
My thought was, wouldn’t someone be able to monopolize on ownership? Like is the actual answer, more is power. Well first let’s talk about what proof of work means.
select nodes based on computing power?
- Select nodes in proportion to computing power
- Let nodes compete for right to create block
- Make it moderately hard to create new identities
(Attacks on identity creation and on the Sybil attack)
Let’s look at a more concrete example. I agree it sounds vague and I’m lost. Though looking at the next slide that just says hash puzzle and has the words nonce… this does not look that illuminating.
Nonce – specific number (Again, according to Merriam-Webster: the one, particular or present occasion)
So bitcoin achieves Proof-of-Work using hash puzzles. I’ll talk more about the hash puzzle further down.
To create a block to add to the block chain, you need to find “nonce” such that H(nonce | prev_hash | tx| tx…|tx) is very small.
(nonce | prev_hash | list of trxn that comprise the block)
Then take the hash of this whole, long string.
Then the hash if correct, should be a very small number . By very small, I mean that it falls within a certain target space in relationship to the output space of the hash.
If the hash function is secure, the only way to succeed to try enough nonces until you get lucky. The reason for the nonce is that you want to make it moderately difficult.
This is the computational puzzle that the node is required to create a new block.
Proof of Work Properties:
- Difficult to compute
Aug 2014: about 10^20 hashes/block
only some nodes other to compete – miners - Parameterizable Cost
Nodes automatically re-calculate the target every two weeks
average time between blocks = 10 minutes - Easy to verify – once you find the nonce, everyone else can check. Thus no need to have centralization since other miners will verify another miner.
What this means is that if you’re a miner, and you’ve put in some capital, over a two week period, there should be more blocks found. Thus you constantly need to put in more hardware investment to find more blocks.
Prob(Alice wins next block) = fraction of global hash power she controls.
If blocks came close together, there would be less efficient. We like putting hundreds of transactions into the block.
Key Security Assumption
- attacks infeasible if majority of miners weighted by hash power follow the protocol (honest)
- if the majority are honest, because of the competition of competing for block then you know they will come from an honest node
Solving hash puzzles is probabilistic
Need to try them one by one to hope one succeeds
Bernouilli Trials
Poisson Process should shows this exponential distribution
for a individual miner:
mean time to find block = 10 min/fraction of hash power
Proof of work is a way to
- Select nodes in proportion to computing power
- Let nodes compete for the “right” to create blocks
A block in the block chain was found at time t. What is the probability that the next block was found at or before t+10 min? Assume that the total hash power of the network stays constant.
More than 50%