1
00:00:00,750 --> 00:00:03,050
Now we're going to talk
about mining pools.

2
00:00:03,050 --> 00:00:05,090
So what is a Mining pool?

3
00:00:05,090 --> 00:00:09,130
Well let's look at the economics
of being a small miner.

4
00:00:09,130 --> 00:00:14,150
So say you're an individual who spent
$6,000 of your hard earned money

5
00:00:14,150 --> 00:00:16,520
to buy a nice shiny new
Bitcoin mining rig.

6
00:00:18,760 --> 00:00:21,810
Now you expect that you will find a block

7
00:00:21,810 --> 00:00:24,020
in about 14 months with
this fancy new rig.

8
00:00:25,040 --> 00:00:30,880
And remember that a block is worth
about $15,0000 at today's prices.

9
00:00:32,260 --> 00:00:34,840
So if you amortize that you
could say that the expected

10
00:00:34,840 --> 00:00:37,671
revenue of this box is
about $1,000 per month.

11
00:00:39,500 --> 00:00:42,720
And now maybe once you factor in
electricity and your other costs

12
00:00:42,720 --> 00:00:46,590
of operating it, if you actually got a
check in the mail every month for $1,000.

13
00:00:46,590 --> 00:00:52,400
That would make it worth it for
you to buy this $6,000 mining rig.

14
00:00:52,400 --> 00:00:55,010
But remember that mining
is a random process.

15
00:00:55,010 --> 00:00:57,580
You don't know when you're
going to find the next block.

16
00:00:57,580 --> 00:01:00,450
It's a completely random search.

17
00:01:00,450 --> 00:01:02,360
And you can find your
next block at any time.

18
00:01:04,190 --> 00:01:09,020
So if we look at the distribution
of how many blocks you're likely to

19
00:01:09,020 --> 00:01:13,660
find in the first year with that
hypothetical one terahertz blocks,

20
00:01:14,940 --> 00:01:16,910
the variance is pretty high.

21
00:01:16,910 --> 00:01:19,740
Because the expected number of blocks
you're going to find, is so low.

22
00:01:21,170 --> 00:01:26,190
So if we just look at the distribution,
and this is a Poisson distribution,

23
00:01:26,190 --> 00:01:29,900
there's over a 40% chance that you won't
find any blocks in the first year.

24
00:01:30,910 --> 00:01:34,850
In which case you might really be in
trouble if you haven't earned any revenue

25
00:01:34,850 --> 00:01:38,720
in an entire year of running that
$6,000 box that costs a lot of

26
00:01:38,720 --> 00:01:39,639
electricity to run.

27
00:01:41,950 --> 00:01:46,050
There's about a 36% chance that you'll
find one block in the first year

28
00:01:46,050 --> 00:01:48,360
in which case maybe you'll
barely scraping by.

29
00:01:48,360 --> 00:01:52,750
And then there's a slightly smaller
chance that you'll find two or

30
00:01:52,750 --> 00:01:56,200
more blocks in which case you'll really
be making a profit with this thing.

31
00:01:57,830 --> 00:02:01,400
So again, on expectation you might be

32
00:02:01,400 --> 00:02:05,280
just doing okay enough to
make a return on your money.

33
00:02:05,280 --> 00:02:07,380
But there's a big chance that
you'll make nothing at all.

34
00:02:08,720 --> 00:02:09,420
So that means that for

35
00:02:09,420 --> 00:02:13,640
a small miner, mining is
essentially a big game of roulette.

36
00:02:17,010 --> 00:02:21,910
Now, historically when a small business
people faced a lot of risk and they wanted

37
00:02:21,910 --> 00:02:26,680
to lower the risk, they got together and
formed mutual insurance companies.

38
00:02:26,680 --> 00:02:29,280
So farmers would get together and

39
00:02:29,280 --> 00:02:33,030
agree that if any individual
farmer's barn burned down,

40
00:02:33,030 --> 00:02:37,190
they would share profits with that farmer
so that that farmer wouldn't go bankrupt.

41
00:02:39,360 --> 00:02:42,810
And the question is can we have
a mutual insurance model that works for

42
00:02:42,810 --> 00:02:44,270
small Bitcoin miners?

43
00:02:46,430 --> 00:02:48,080
So that's what a Mining pool is.

44
00:02:49,200 --> 00:02:54,670
Now, the goal of a Mining pool is that
a group of miners will get together,

45
00:02:54,670 --> 00:02:58,140
form a pool, and
they'll all attempt to mine a block.

46
00:02:58,140 --> 00:03:03,470
Which pays the coin base, the newly
minted coins to the same recipient.

47
00:03:03,470 --> 00:03:05,980
That recipient is going to
be called the pool manager.

48
00:03:07,220 --> 00:03:11,440
So no matter who actually finds the block,
the pool manager will control the rewards.

49
00:03:14,340 --> 00:03:16,980
And then the pool manager
will take that revenue and

50
00:03:16,980 --> 00:03:19,990
distribute it to all of
the participants in the pool

51
00:03:19,990 --> 00:03:22,960
based on how much work each
participant actually output.

52
00:03:24,790 --> 00:03:27,820
Of course, the pool manager will also
probably take some kind of cut for

53
00:03:27,820 --> 00:03:30,310
their service of managing the pool.

54
00:03:33,520 --> 00:03:34,830
So this sounds like a great idea.

55
00:03:34,830 --> 00:03:38,610
You can see why it would be attractive to
BitCoin miners to join a pool to lower

56
00:03:38,610 --> 00:03:40,450
their variance.

57
00:03:40,450 --> 00:03:43,728
But how does the pool manager know how
much work each of the members of the pool

58
00:03:43,728 --> 00:03:44,771
is actually performing?

59
00:03:45,820 --> 00:03:48,797
Obviously the pool manager doesn't
want to just take everybody's word for

60
00:03:48,797 --> 00:03:51,587
it because everybody would say that
they're performing more work than

61
00:03:51,587 --> 00:03:52,389
they actually did.

62
00:03:55,117 --> 00:03:57,978
So there's a really powerful
idea which is that miners

63
00:03:57,978 --> 00:04:02,280
can prove probabilistically how much
work they're doing by outputting shares.

64
00:04:02,280 --> 00:04:04,685
And shares are blocks
that are almost valid.

65
00:04:06,104 --> 00:04:10,951
So whereas it's pretty rare to find
an actually valid block that starts

66
00:04:10,951 --> 00:04:15,490
with all 66 required zeroes at
the beginning of the output hash.

67
00:04:17,020 --> 00:04:21,453
There will be a lot more almost blocks
that start with a lot of zeros but

68
00:04:21,453 --> 00:04:25,774
not quite the 66 necessary
to make it a valid block.

69
00:04:25,774 --> 00:04:28,730
So a common choice might be say 40 bits or

70
00:04:28,730 --> 00:04:33,510
maybe 50 bits depending on what
size the pool is designed for.

71
00:04:35,800 --> 00:04:40,420
Now if miners participating in the pool
send in a bunch of these near valid

72
00:04:40,420 --> 00:04:43,980
blocks, the rate at which you're finding
those near valid blocks should give

73
00:04:43,980 --> 00:04:49,990
the pool manager a very good statistical
idea of who's doing how much work.

74
00:04:49,990 --> 00:04:53,620
And the other nice property of this
is that there's no way to fake it.

75
00:04:53,620 --> 00:04:57,429
Because of the properties of the hash
function, there's no way to find almost

76
00:04:57,429 --> 00:05:00,620
blocks without also finding actual
blocks at the expected rate.

77
00:05:02,830 --> 00:05:04,230
So how does this whole setup look?

78
00:05:06,000 --> 00:05:11,290
So to start with, in each round after
the previous block is discovered,

79
00:05:11,290 --> 00:05:17,275
the pool manager, which will be collecting
transactions and assembling a block.

80
00:05:17,275 --> 00:05:19,450
Will tell all of the participants,

81
00:05:19,450 --> 00:05:21,470
here's the next block that
we're all going to work on.

82
00:05:24,230 --> 00:05:27,140
So they'll assemble the block header.

83
00:05:27,140 --> 00:05:31,800
They'll assemble a Merkle tree of
transactions to be included in that block.

84
00:05:31,800 --> 00:05:35,450
And in particular, they'll make sure to
put into that mrkl_root of transactions,

85
00:05:35,450 --> 00:05:38,840
the coin based transaction
which creates new coins and

86
00:05:38,840 --> 00:05:40,650
assigns ownership to the pool itself.

87
00:05:41,760 --> 00:05:46,240
And now this block header will be sent to
all of the participants in the pool and

88
00:05:46,240 --> 00:05:47,640
this is what they're asked to work on.

89
00:05:47,640 --> 00:05:51,260
And they have to prove that they have
been working on it by sending in shares,

90
00:05:51,260 --> 00:05:52,979
showing that they've
been hashing this block.

91
00:05:55,560 --> 00:06:00,350
Now once that gets sent out, all of
the miners go about and do their work.

92
00:06:00,350 --> 00:06:04,980
And they'll all slowly find almost valid
blocks or shares until finally one of

93
00:06:04,980 --> 00:06:10,048
the miners, hopefully in the pool, finds
a valid block that will then be published.

94
00:06:11,854 --> 00:06:15,592
Now after this happens, all of
the participants will send in all of

95
00:06:15,592 --> 00:06:20,133
the shares that they found to the pool
manager, which should be pretty efficient

96
00:06:20,133 --> 00:06:24,040
for the pool manager to verify
are valid shares that they've found.

97
00:06:25,280 --> 00:06:28,410
And then the pool manager will take all of
the revenue earned from that block that

98
00:06:28,410 --> 00:06:32,020
was published and
distribute it back to the participants.

99
00:06:32,020 --> 00:06:33,780
Based on how much work they actually did.

100
00:06:35,170 --> 00:06:38,930
Now notice that this miner all the way
on the right here who did happen to find

101
00:06:38,930 --> 00:06:43,500
the block, actually receives less revenue
than that miner on the left there,

102
00:06:43,500 --> 00:06:47,360
who didn't find the ultimately valued
block, but they did find more shares.

103
00:06:48,400 --> 00:06:49,550
So there's no bonus for

104
00:06:49,550 --> 00:06:52,370
this miner on the right here that
they actually found a valid share.

105
00:06:53,590 --> 00:06:56,080
They would have been better off if
they had just mined as an individual,

106
00:06:56,080 --> 00:07:00,820
because they would have gotten to keep
all of the revenue from that block.

107
00:07:00,820 --> 00:07:03,450
But of course for
the miner on the left they're sure

108
00:07:03,450 --> 00:07:07,210
going to be glad that they joined this
pool, because they would've got nothing if

109
00:07:07,210 --> 00:07:10,330
they had just mined on their own, because
they happened to not find a valid block.

110
00:07:12,790 --> 00:07:16,680
So there are a bunch of variations on this
model of exactly how you determine based

111
00:07:16,680 --> 00:07:21,630
on shares submitted, how much money
each miner should get in mining rewards.

112
00:07:21,630 --> 00:07:23,370
So a couple of common ones.

113
00:07:23,370 --> 00:07:27,790
There's the pay per share model,
where the pool manager just announces,

114
00:07:27,790 --> 00:07:31,550
I'll pay a flat fee for every share above
a certain difficulty that you're willing

115
00:07:31,550 --> 00:07:32,990
to send me based on this block.

116
00:07:34,530 --> 00:07:37,730
In some ways that's the best for
miners, because that's a guarantee.

117
00:07:37,730 --> 00:07:40,770
Every time they find a share,
they'll get a certain amount of money.

118
00:07:41,910 --> 00:07:45,550
The pool manager is essentially absorbing
all of the risk in that scheme.

119
00:07:47,220 --> 00:07:49,850
Of course, as a result,
usually with pay per share,

120
00:07:49,850 --> 00:07:52,665
you pay the highest transaction
fee to the pool manager.

121
00:07:55,050 --> 00:07:57,490
Another way to do it is
a proportional model,

122
00:07:57,490 --> 00:07:59,931
where instead of paying
a flat fee per share,

123
00:07:59,931 --> 00:08:05,410
the amount per share depends on whether or
not the pool actually found a valid block.

124
00:08:05,410 --> 00:08:10,620
So every time a valid block is found, the
rewards from that block are distributed

125
00:08:10,620 --> 00:08:13,429
to the members proportional to
how much work they actually did.

126
00:08:14,560 --> 00:08:17,800
So in this case,
the miners still bear some risk,

127
00:08:17,800 --> 00:08:20,910
proportional to the risk
of the pool in general.

128
00:08:23,010 --> 00:08:24,850
So if the pool is large enough,

129
00:08:24,850 --> 00:08:28,450
the variants of how often the pool
finds blocks will be fairly low.

130
00:08:28,450 --> 00:08:31,430
Proportional can still be a good approach.

131
00:08:32,960 --> 00:08:35,790
And it will provide lower risk for
the pool manager.

132
00:08:35,790 --> 00:08:39,138
And it gets around a problem
that's inherent to pay per share,

133
00:08:39,138 --> 00:08:40,906
which is that with pay per share,

134
00:08:40,906 --> 00:08:45,370
the miners actually don't have any
motivation to send in valid blocks.

135
00:08:45,370 --> 00:08:46,970
That don't have any motivation not to,

136
00:08:46,970 --> 00:08:52,200
but miners have the option when they find
a valid block of just keeping it a secret.

137
00:08:52,200 --> 00:08:53,940
Now they're hurting
the pool by doing that.

138
00:08:53,940 --> 00:08:56,120
So this is purely an act of vandalism.

139
00:08:57,120 --> 00:09:00,480
But they have no real motivation since
they get a flat reward per share,

140
00:09:00,480 --> 00:09:02,780
to actually send in the valid blocks.

141
00:09:02,780 --> 00:09:05,950
Whereas with the proportional scheme, the
miners certainly want to send in the valid

142
00:09:05,950 --> 00:09:08,910
blocks because that triggers
revenue coming back to them.

143
00:09:11,050 --> 00:09:14,480
And a final variation that I think is
interesting and was popular for a while.

144
00:09:15,890 --> 00:09:20,620
Is that the pool owner
actually collects no fee but

145
00:09:20,620 --> 00:09:27,080
minors can't receive any revenue out
until their balance is over one bitcoin.

146
00:09:27,080 --> 00:09:29,950
So basically that means the new
entrants to the pool don't

147
00:09:29,950 --> 00:09:31,880
make any money for a while.

148
00:09:31,880 --> 00:09:35,210
And then they make money at
an even rate without paying any

149
00:09:35,210 --> 00:09:36,860
fee to the mining pool manager.

150
00:09:39,700 --> 00:09:42,690
So essentially, once you're established
in a pool with this approach,

151
00:09:42,690 --> 00:09:45,140
it's a great place to be, but
they're harder to break into.

152
00:09:49,400 --> 00:09:51,070
So this has become pretty advanced now.

153
00:09:51,070 --> 00:09:54,630
There are quite a few
protocols to run mining pools.

154
00:09:54,630 --> 00:09:57,350
And it's even been suggested that
these mining pool protocols should be

155
00:09:57,350 --> 00:09:59,370
standardized as part of Bitcoin itself.

156
00:10:00,470 --> 00:10:04,160
So, just like there's a Bitcoin protocol
for running the peer to peer network,

157
00:10:04,160 --> 00:10:08,600
these protocols are an API for
communicating from the pool manager to all

158
00:10:08,600 --> 00:10:13,340
of the members, when to work on a new
block, what that block should be.

159
00:10:13,340 --> 00:10:16,420
And for the miners to send back to
the pool manager the shares that

160
00:10:16,420 --> 00:10:17,090
they're finding.

161
00:10:18,840 --> 00:10:21,720
Another reason why this is so
important is that some mining

162
00:10:21,720 --> 00:10:24,700
hardware actually supports these
protocols at the hardware level.

163
00:10:24,700 --> 00:10:29,410
Now this makes it very simple to
buy a piece of mining hardware,

164
00:10:29,410 --> 00:10:34,140
plug in into the wall, both the
electricity and your network connection.

165
00:10:34,140 --> 00:10:35,100
Choose a pool and

166
00:10:35,100 --> 00:10:38,120
then it will start immediately
getting instructions from the pool.

167
00:10:38,120 --> 00:10:43,340
Mining and converting your
electricity hopefully into money.

168
00:10:47,130 --> 00:10:51,250
So mining pools first started
around 2010 actually way back

169
00:10:51,250 --> 00:10:55,330
in the graphics card era of Bitcoin
mining, which is several generations ago.

170
00:10:55,330 --> 00:10:58,670
And they were instantly very popular,
for obvious reasons,

171
00:10:58,670 --> 00:11:01,360
because they lowered the variance for
the participating miners.

172
00:11:03,050 --> 00:11:07,940
So by 2014 the vast majority of all
miners are mining through pools.

173
00:11:07,940 --> 00:11:10,010
Very few miners mine on their own anymore.

174
00:11:11,780 --> 00:11:15,830
And a very interesting thing
happened in June of this year.

175
00:11:15,830 --> 00:11:19,850
Where the largest pool,
called GHash.io, got so

176
00:11:19,850 --> 00:11:24,030
big it actually had over 50% of the entire
capacity of the Bitcoin network.

177
00:11:24,030 --> 00:11:28,230
Now this is something that people
had feared for a long time, but

178
00:11:28,230 --> 00:11:32,400
essentially GHash offered such a good
deal to all the participating miners

179
00:11:32,400 --> 00:11:34,250
that everybody wanted to join.

180
00:11:36,180 --> 00:11:39,390
Now since then, GHash has gone down
a little bit, partly be design.

181
00:11:39,390 --> 00:11:43,860
They've made their fees a little bit
less attractive to try to get smaller.

182
00:11:43,860 --> 00:11:47,690
But you can see in this pie chart
of the largest mining pools,

183
00:11:47,690 --> 00:11:49,330
they still have about
a third of the power.

184
00:11:49,330 --> 00:11:53,200
And it's basically only two mining
pools today that control about

185
00:11:53,200 --> 00:11:54,520
half of the power in the network.

186
00:11:54,520 --> 00:11:57,800
And then there's a nice smattering
of other pools thrown in there.

187
00:12:00,980 --> 00:12:03,290
So are mining pools a good thing?

188
00:12:03,290 --> 00:12:08,560
Well the advantages of mining pools are
that they make mining more predictable for

189
00:12:08,560 --> 00:12:11,180
the participants and
they make it much easier for

190
00:12:11,180 --> 00:12:13,029
smaller miners to get
involved in the game.

191
00:12:14,035 --> 00:12:18,330
Whereas the variance would simply make
mining infeasible for economic reasons.

192
00:12:18,330 --> 00:12:20,390
If you didn't have mining pools.

193
00:12:20,390 --> 00:12:24,050
You can operate a much smaller mining
rig profitably if you're part of a pool.

194
00:12:25,840 --> 00:12:30,290
Another advantage of mining pools is that
since there's one central pool manager,

195
00:12:30,290 --> 00:12:32,790
whose sitting on the network and
assembling blocks.

196
00:12:32,790 --> 00:12:35,630
It actually makes it easier to
upgrade the network because by

197
00:12:35,630 --> 00:12:39,700
upgrading the software that
the mining pool manager is running,

198
00:12:39,700 --> 00:12:43,550
that effectively updates the software
that all of the pool members are running.

199
00:12:45,310 --> 00:12:47,630
The disadvantages of
the mining pools of course,

200
00:12:47,630 --> 00:12:50,100
is that this leads to centralization.

201
00:12:50,100 --> 00:12:54,140
It's an open question of how much power
the operators of a large mining pool

202
00:12:54,140 --> 00:12:54,720
actually have.

203
00:12:56,160 --> 00:13:00,380
Of course miners are fairly free in
theory to move between pools as much as

204
00:13:00,380 --> 00:13:01,460
they like.

205
00:13:01,460 --> 00:13:05,350
If you're making profit on one pool,
you'll likely make very similar profit in

206
00:13:05,350 --> 00:13:08,680
another pool because the fees
that they pay out have converged.

207
00:13:08,680 --> 00:13:12,000
They all offer about the same deal today.

208
00:13:12,000 --> 00:13:15,970
But in practice miners don't switch very
often, simply because they're lazy and

209
00:13:15,970 --> 00:13:18,730
it's easier to keep using the pool
that they've already signed up for.

210
00:13:20,190 --> 00:13:24,240
And another disadvantage of mining
pools is that it lowers the population

211
00:13:24,240 --> 00:13:28,610
of people actually running
a fully validated bitcoin node.

212
00:13:28,610 --> 00:13:32,710
So previously small miners all had to
run their own fully validating node,

213
00:13:32,710 --> 00:13:36,890
they all had to store the entire block
chain, and validate every transaction.

214
00:13:36,890 --> 00:13:40,290
Now most miners offload that
task to their pool manager.

215
00:13:41,320 --> 00:13:45,096
And this is one reason why a couple of
lectures ago, I said the number of fully

216
00:13:45,096 --> 00:13:48,525
validating nodes may actually be
going down in the Bitcoin network.

217
00:13:50,760 --> 00:13:53,697
So if you're concerned about
this level of centralization,

218
00:13:53,697 --> 00:13:57,660
you might ask could we redesign the mining
process so that we don't have any pools?

219
00:13:57,660 --> 00:13:59,890
So that everybody has to mine for
themselves.

220
00:14:01,370 --> 00:14:05,248
And once again, that's going to be a very
interesting topic that we'll talk about

221
00:14:05,248 --> 00:14:07,713
in our lecture on alternative
mining approaches.

