馃攳
How bitcoin miners collect their reward? | How miners send mining reward in their digital wallet? - YouTube
Channel: codebasics
[0]
I made a video on bitcoin mining in 15
[4]
lines of python code and I received
[6]
many questions same questions such as
[10]
what do you do after you get a new hash
[13]
or
[13]
how do you exactly redeem your reward so
[16]
in this video I am going to tell you how
[18]
bitcoin miners
[19]
redeem their reward and transfer those
[22]
bitcoins to
[23]
their digital wallet. Now this particular
[26]
video is a prerequisite
[27]
so make sure you watch bitcoin mining in
[30]
15 lines of python code
[32]
first and then you jump on to this video.
[36]
also if you don't know what is bitcoin
[38]
then you can
[39]
in YouTube type in what is bitcoin code
[41]
basics and you will find this
[43]
this particular video where I have
[44]
explained bitcoin using a
[46]
simple analogy so you what that and now
[49]
let's start
[50]
this particular topic so in real life
[53]
there are transactions
[54]
happening in bitcoin. Bitcoin is like a
[57]
currency so let's say Rob goes to a
[59]
coffee store
[60]
and he will buy coffee for this
[61]
particular amount
[63]
and then let's say it's my brother's
[66]
birthday I give him
[67]
five bitcoin as a birthday gift and Jim
[70]
bought
[70]
two bitcoin from coinbase so there are
[72]
people throughout the world making all
[74]
these transactions
[75]
in bitcoin and these transactions go to
[78]
an area called transaction buffer
[80]
or a mempool and these are unconfirmed
[82]
transaction which means
[83]
these are not added to your blockchain
[86]
yet
[86]
and the job of bitcoin miners
[90]
is to produce valid blocks. So there are
[93]
popular bitcoin miners such as f to pull
[95]
and pull slush and so on and they will
[97]
be looking at this transaction buffer or
[100]
listening to this transaction buffer
[102]
get the block of transactions you know
[105]
like
[106]
2 megabyte or that there is a block
[108]
limit so
[109]
they get certain amount of transaction
[111]
and they start
[112]
mining it you know they start
[115]
producing that hash
[116]
which I discussed in my previous video
[118]
and let's say f to pull is the first one
[120]
who can
[122]
you know who can come up with the valid
[124]
block.
[125]
It's possible that other miners might
[127]
come up with the valid block
[129]
but this is a game of who gets lucky
[132]
as well as who is fast. You know so it's
[134]
a combination of those two factors but
[137]
in this scenario let's say f to pull
[139]
comes up with the
[140]
valid hash and that has gets added to
[144]
our official blockchain. Now let's go
[146]
little into detail on how this
[148]
particular block is mined this is what I
[150]
covered in my last video
[152]
but basically let's see if I'm f to
[155]
pull
[156]
I will collect all these transactions
[158]
from the transaction buffer
[160]
so this particular block is transactions
[163]
and it will have a previous hash as well
[165]
now this is the first
[166]
block so previous hash is zero but usually
[169]
you
[169]
only have a block so you get a previous
[171]
hash and then you produce
[173]
the sha 256 or a hash for the entire
[177]
block
[178]
in this green particular rectangle.
[181]
So whatever content you see in this
[183]
great green rectangle
[185]
we make a hash out of it and let's say
[188]
hash is 0 45
[189]
whatever. Now if you notice
[193]
the transactions carefully very
[195]
important is this yellow transaction
[198]
so at the end of the transactions at the
[201]
end of the block
[202]
the miner will add a transaction to
[206]
himself or herself saying that reward me
[209]
6.25 bitcoin. So as of 2021
[213]
April the reward for mining one block is
[216]
625 bitcoin.
[218]
so the miner will add a transaction to
[220]
himself or herself
[222]
in that block itself so it's not like
[224]
you're mining and then later on someone
[226]
transfers you the money.
[228]
As part of the mining process itself you
[231]
add
[232]
a reward to yourself in that block and
[235]
then whatever you see in this green box
[237]
you produce hash out of that. So now
[240]
you all know that you know it's a
[242]
guessing game so you have nonce is equal
[245]
to 1.
[245]
then you put nonce is equal to 2.
[248]
you
[248]
keep on trying this it's a trial and
[251]
error you keep on trying these nonce
[253]
and eventually let's say for some nonce
[257]
you know this is not non 3 but let's say
[260]
for some
[261]
20 000 or 1 trillion nonce you get
[264]
first four zeros I'm just giving
[266]
hypothetical example
[268]
that if my protocol says that a valid
[272]
hash is the hash which has four leading
[275]
zeros
[276]
then once I get to this hash
[280]
it means I have produced a legitimate
[283]
block which I can add to the blockchain.
[286]
So once
[287]
once I get this I will broadcast in my
[290]
network saying that hey
[291]
I have produced a valid block and the
[294]
other peers will
[295]
add this to the blockchain it becomes
[298]
part of the blockchain
[299]
and when it becomes part of the
[301]
blockchain you already have a reward
[303]
so to answer that question how do you
[306]
redeem the reward
[307]
Well, while you are mining the block
[310]
you have added that transaction that
[313]
reward
[314]
in that block itself. So all you need to
[318]
know
[318]
do now is wait till
[321]
the block gets added to the official
[324]
blockchain.
[325]
And once it is in official blockchain
[327]
you have
[328]
already won that reward so the actual
[331]
blockchain looks like this where
[334]
the last transactions in every block
[337]
is the reward actually okay so here
[339]
let's say
[340]
this block was mined by f to pull the
[342]
other block was mined by a miner called
[344]
slush
[346]
third block was mined by let's say and
[347]
pull so if you look at the whole
[349]
blockchain
[350]
you in every block you will see a
[353]
transaction a reward
[355]
going to a miner.
[358]
Now I'm going to show you a real block
[361]
so if you go to blockchain.com and click
[363]
on explorer
[364]
you will see all the blocks which are
[366]
being mined so let me look at this
[368]
particular block you know this block was
[370]
mined by f to pull
[371]
44 minutes ago and when I open this
[375]
block
[376]
what I see is general block information
[378]
so right now the difficulty so in my
[380]
presentation I said
[381]
the difficulties first four zeros you
[384]
see first four zeros
[385]
first four zeros right in reality the
[387]
difficulty
[388]
is first 20 zero so if you count
[390]
this this is twenty zeros
[392]
so f two pull was able to successfully
[394]
mine this particular block
[397]
with 20 leading zeros okay? and you will
[400]
see
[401]
all let's say this particular block had
[404]
100
[406]
uh how much okay 1091
[410]
transactions and the block reward was
[414]
6.25
[416]
and the fee reward. So there are you know
[419]
transaction fees as well
[421]
so in this one he got block reward of
[424]
625
[425]
and the transaction phase is 0.9111
[429]
whatever. right so
[430]
if you just sum this two numbers so let
[433]
me just
[434]
sum these two numbers
[441]
7.161 so you will see
[444]
7. you see 7.161
[447]
..
[448]
going to f to both so this is f to pulls
[452]
digital wallet
[453]
the the public key so this reward
[457]
went to f2 and you know it's like from
[460]
into
[461]
so in the from it says coinbase newly
[463]
generated coins you see
[465]
newly generated coins and then there are
[467]
rest of the transactions.
[469]
So the hash this particular hash was
[472]
produced including the reward
[475]
transaction.
[476]
So now you get the point and you look at
[479]
other transactions see so many other
[480]
transactions like
[481]
10 pages all right in other transaction
[485]
let's say this transaction. This
[487]
particular address okay
[488]
this particular address stands for 12.42
[492]
bitcoin to you know all these addresses
[495]
so it's like from one to many
[499]
the destination is like many
[502]
many digital wallet addresses. So the
[505]
source address here
[506]
you can see the source address total
[509]
received total sent
[510]
some transaction history and so on
[513]
but this particular transaction is you
[516]
know it's a special transaction. It is
[517]
the transition which I showed you here
[519]
in yellow
[520]
it is how bitcoin
[524]
miners get a reward so I hope that
[526]
clarifies your understanding on how
[528]
exactly miners get the money in their
[532]
wallet
[532]
and if you have any further question
[534]
post in a comment below
[536]
I'm going to make a playlist so the
[538]
playlist link is in the video
[539]
description below so
[540]
go check it out I will be posting many
[542]
more videos on bitcoin and
[544]
cryptocurrencies.
[546]
Thank you very much for watching.
Most Recent Videos:
You can go back to the homepage right here: Homepage





