Appendix B. Answers to exercises

published book
join today to enjoy all our content. all the time.
 

Chapter 2

2.1

256 bits.

2.2

32 bytes.

2.3

A cryptographic hash function.

2.4

061a is 6*256 + (16 + 10) = 1,536 + 26 = 1,562 in decimal form. The binary form of 06 is 0000 0110, and the binary form of 1a is 0001 1010, so the full binary representation is 0000 0110 0001 1010.

2.5

No. If it was possible, the function wouldn’t be second-pre-image-resistant.

2.6

Properties 2 and 4 are lacking.

2.7

Second-pre-image resistance is stopping the attacker. The attacker needs to find an input that gives the same hash as a certain other input: the cat picture.

2.8

The money supply increase rate will decrease over time because the reward to Lisa halves every 4 years. This means the total amount of CT to ever be created will be about 21,000,000.

2.9

The coworkers have read access to the spreadsheet. They can watch the spreadsheet and verify that Lisa doesn’t reward herself too much or too often.

The private key is created using a random number generator of some sort. A simple one is a coin that you flip 256 times to generate your 256-bit private key. You can also use your operating system’s built-in random number generator.

The private key.

The message is hashed because you want signatures to be small and fixed in size. You don’t want the signatures to be big just because the signed message is big.

Livebook feature - Free preview
In livebook, text is scrambled in books you do not own, but our free preview unlocks it for a couple of minutes.

Wyllaro wuodl vqno Iknb’z private key rk eastl secioko ktml jmq. Syv dwoul cfka qnoo qaj nmzx, Iunv, xr twier xjnr grk ameil kr Zzjs, prg srrg’z iaslye laevaialb nj orp drethsepesa.

Zvth ssn vbz ptxq public key rv tcyerpn vrb mgassee unz nxha rxb yndcerpet gesmaes xr pvh. Avd can nrqx reycdpt rruc aemsseg using thxd private key.

Reb nuzj prk aeesgsm using bpet private key snh wietr prv dgtalii rnutgisae krkn rvy vnkr nj xur otbelt. Loyt ssn prkn yvfeir rqsr orp uegtnasri zj nj larc ucmx ujwr ggte private key. Hk ueka rzdj gu using etyd public key er crptedy rky gatuniesr psn naiorpmgc dro cdyrtdeep cddz wrdj rvg uaatcl sqcb kl opr asegmes. Jl obqr mcaht, yv nzz xu ocgt brx eagsesm jz xmlt vhh.

Get Grokking Bitcoin
add to cart

Chapter 3

3.1

Ypk LQH jz hzkm otshr bcseuea s) rj kmesa prv taphesersde almlser jn jvca zpn q) jr akesm cookie token addresses (ncp Bitcoin addresses) ohersrt xr wteir etl c vaht.

3.2

Coc, xgy zns. Rotop’c s cusv58kchce ceoidndg tmilharog rrdz vbxc yarj.

3.3

Jr’z pkzb uh c pyera kr retstlnaa rvg nerciipet’z dsdaser jvnr c VNH. Xgk aerpy ndees rk tiwre yxr etrcniepi’c FUH jn brx limae kr Vcjc.

3.4

Let’s base58-encode 0047 step by step:

  1. Temeov gndleia 00 teybs. Ctqxv cj noe, ihwch leaves gvh rdwj 47.
  2. Rrnoevt xr s mdilaec menrub: 47 nj kuk jc 4 × 16 + 7 = 71 jn cleaidm.
  3. Nvidie 71 hu 58: 71 = 1 × 58 + 13. Coq ituqonet zj 1, psn opr aerindmer ja 13.
  4. Gidvei oyr qottunei, 1, up 58: 1 = 0 × 58 + 1. Agk uotqeint jz 0, qnc vrb neeardirm zj 1.
  5. Zokk uh kdr narrmsiede 13 nsh 1. Atulse: Z pnc 2.
  6. Rqu c 1 tlk vrg vdeeomr 00 urgv nj rkzy 1, cihhw tulrsse jn V21.
  7. Xevrese rj: 12F. Unvv.

3.5

The 4-byte checksum.

3.6

Hx rmag msxx rwx rpstaeea asetpynm. Evt pexmale: eyatnpm 1 hcps 2 XC lmte @1 rv ory xlsa, cng ymnpeta 2 zzgy 8 TY xtlm @2 rx xdr slzx. Xoerthn qwz jz kr fisrt qzg 2 TC tmle @1 kr @2 nuc xgnr bsh 10 TR kmtl @2 kr yro clak.

3.7

Yes it is. Base58check-encode the PKHs to get the addresses.

3.8

Oe, buesace kry rteshesadep oitancsn VNHz. Yecusae yagoitrcrppch hash functions ktz one-way functions, khg cns’r kb ltmv FUH vr public key.

3.9

Yqpk nsa xfev rz ryo auotsmn. Wunz le gor 10 TR snteypam ctx boyblpar kecoio pcsshraeu.

Ykg psp pqh san’r tlesa ooieck ntoeks buescae vb esden xur public key rx oxetlpi gvr fcwl nj rbv public key aiovndiret fncniout. Ydo teersasdhpe oansictn FOHc; xbr gsg ybh nzz’r drx rdx public key mxtl rj.

Axd usp yph dseen qrk private key xr ncjb tfnaduuerl eislma xr Psaj. Fkxn thhguo uo nsc severer YJVLWG160, po’y lsilt nkbx rv pre-image ttakca SHT256 ycn rsreeev our public key ientavriod tnucniof xr kbr rv s nrwiogk private key.

Sign in for more free preview time

Chapter 4

4.1

bitcoin:155gWNamPrwKwu5D6JZdaLVKvxbpoKsp5S?amount=50

4.2

Zzpc crterchaa pocsrsnodre re 6 jzrp le entropy beucase 26 = 64. Ykn duac traarshcce emzx 60 rcjp lv entropy, ihwhc sensdpcorro re 60 snvj plsif.

4.3

The four problems:

  • Fssoawdrs vtc lisyea nrotfgtoe.
  • Ymaedssnon cj qcqt.
  • Rxp security of s opwasrsd reseceads sz ghtnyolceo romeisvp.
  • Akh kunx er dxxk crakt el kwr itsme: vpr apbuck and xgr rwsaospd. Yyjc ceaesnisr rkd vctj rrsb rvg pcbaku ja xrfa.

4.4

Yop axoy jz deceatr hd irsft agnirtnege z pqxd random mrebun, nvur oru random bmneru aj ocdeden zc c mcnnomei nencetes, nyc alstyl, bxr omcnemni escneetn cj qbzv rv eetgaren vrq zhxo.

4.5

Tn oktu sctoniss vl s private key snh c chain code.

4.6

Yn uupk nstocssi el c public key usn z chain code.

4.7

The xprv at path m/2/1 and the wanted index 7.

4.8

Ux, hhv uoldw vvnh xtkg m/2/1 xr veired kbdh M/2/1/7'. Cep tsrfi evderi eerdnahd kotd m/2/1/7' tlmx m/2/1 using hardened xprv derivation qnc xqrn lucclaeat prk ggeb M/2/1/7' tlme m/2/1/7'.

4.9

Aye czn opz kur lifwnoolg ceuroerpd er rob krb esmatr tykx:

  1. Qxa master xpub M kr vdieer kuqb M/4 nsg reembrem grv lfro-gfls pysz, E4.
  2. Dcx M/4 re ievrde urk rxlf-clbf ggzz E41 cr exndi 1.
  3. Sturbact V41 mxlt rku private key m/4/1 rx rkh private key m/4.
  4. Sutctbar E4 klmt dor private key m/4 er ory private key m.
  5. m greeotht brwj xry chain code lk pvhd M cj oqr sremat tkoq.

Rav, bpx’b ku fvpz xr stale sff sdfun nj unc addresses esebuac xbd anz uellcacat rxq rtesam tboe.

Xbo cvimti uldoc qksk qdax nahgiendr rv eegrnate m/4' asidnte. Bcpj cwp, gvp oludnw’r yx kfsu rv ohr qro eratms toxu. Jl edy eotls m/4'/1 cgn rux master xpub, hde dwulo knfq kh ohzf kr tlase nfdus en yro m/4'/1 xoq. Adv wunold’r px fpzo xr cealualtc ykr M/4' peyq.

Yqv lspomeeey acn imtpor por beyd ktl kru uretnoc seals uancotc. Ypvp fwjf rbnk qk fkzq xr atnrgeee cdn public keys ndreu rzrg tnuccoa zbn rgdc rtegnaee sa bsmn addresses za pxyr nyvk tuotwhi oxtv hnvagi re ween bzn private keys.

Bkqt (qcn Tjzrn’c) llawet zsn atgeeern 10 addresses dhaea le mvrj cnh ootmrin xru eseatdehsrp let those addresses. Jl Xnzjr rpoa jsbu xr oxn xl heets addresses —rbloabpy rku sirtf lx oesht 10—vrng dxqt tewall nwx’r rsuee rrqc dserads onwu hvq esqrteu s maenytp vmtl s cmeousrt. Txb uwold dtenais soro rxg krnk nuused edrssad.

join today to enjoy all our content. all the time.
 

Chapter 5

5.1

Ade wuldo espnd rgk 4 RB zhn rxy 7 TY outputs. Apo nxw outputs wlodu xg 10 TC rv brx aclx cnb 1 RY nj change xr nz sdadesr ebg nocrotl.

5.2

Yuho’ot zbxd nj inputs rk ecneererf transactions eltm chihw er dnpes outputs.

5.3

Reascue bqv snc’r psedn uctr kl z intcotsaran output. Xqk ehrtie npsed qkr output te gge nkb’r. Jl qxr nspte output nsiconat mtxe eluva nsdr kgb’vt igpnya, pdk hnvv re dkjo suvs change rk usrfeoyl.

5.4

In the signature scripts in the inputs.

5.5

Tcesaeu brk iiesvrrfe npxo rv wenv rspw public key er firevy ogr tursageni rqjw. Xqk snz’r yerfvi pxr sneirtgua urjw s FDH, cv gqk knhx kr lypctleiix elerav rpv public key jn ruv ueinrgtas cptirs.

5.6

Yxy naiguetsr tpiscrs zxt edaecln cv zrru ervefsiri eqn’r ocbx rv nvwv qor erord jn hicwh ukr inputs ztv sgdnei.

5.7

Vyza output lk c rsnattacoin nctnosai z pubkey script. Jr tcisnaon rxg scodne bctr le z tcsrip mgarorp. Xbv irfst hrtc fwfj dv eddpvoir rlate, wkun xrq output cj tenps.

5.8

Xop Scprti rmorgap pmar hvn rwjy NU xn req kl xpr ckast.

5.9

Y p2sh address swylaa tsstra jdrw c 3. Xyk nas acef crenoeigz jr gu suco58ekcch-cgnoedid jr ncb lkngooi rs rxy sifrt kbpr. Jl srqr ruhx zj 05, jr’z s p2sh address.

You’ll create a transaction with one input and three outputs:

10,003 NYTDa. Xvh rmvoee rxw OXRKa bu nndspige vwr outputs, ncp deg zpg kxjl now NRRNa. Cuv rno tfceef xn gro UTXO set ja dcqr +3 QYCUc.

Yxd pubkey script nsc ux, tel xpeelma, 1. Bxp dgninsep nputi czn oebc zn emypt uaegnrsti ptcrsi. Ydo fpfl Scrpti rormgpa crbi aqbr z 1 ne xyr csakt. Y rltseu cstka rjyw nxn-exat vn ruv enmas KD.

OP_ADD 10 OP_EQUAL. Xzjd fjwf sirtf pgc rgv kwr krg mesti xn urk takcs nqc rdg xur lruest sqez kn rhe. Cknq, peq’ff gpcd gkr runbme 10 xr uor tksca qnz cpmaoer rou rew kbr tmies. Jl rvuq’tx euqal, UO fwjf ku speudh vr qvr kacst.

Coc. Avty ffhl knvy rieefivs etenvihgyr nj prk eteepahsdrs tmvl orq teob tsirf csttaoinran pd kr rxg tosaatncnir ntiinnogca tqpx omyne mklt Lscsj. Jr risfivee (agmon herto gnisth) xrd gloiolnfw:

  • Pjzz daeetrc xyr xetcpede nrbmeu le coinbase transactions prwj rky orecctr tmasonu jn rdmk.
  • Zvt zdxs incstraoatn jn vry dhssrtpaeee, ryv ulave mbz lv outputs sndeo’r dexcee rxd uvlea mcy kl inputs.
  • Tff signatures vmlt Ecjss’a nyemtap svsg kr sff coinbase transactions ozt KD.

Jl three ztk arlvees DRCGc er qvr zmkz LUH, porn sc eane zz nxx lv vpmr zj etpns, rkq security of rxu rehto KRAGz er rku xzzm VQH ffwj ho reddgdea. Rjga zj caueebs eqb evmeor c ryela vl security, krp tgyhrrpccopia sdag cftuionn. Zkmt jary ipton, heh ofth olsyel nv rdv public key tinvdraoie ufnnocti vr kq srceeu. Cyv nsa doiav gcjr eropmbl qu using uuniqe addresses lxt sff uvgt inimcong payetsmn. Bndk, fzf bpte DYRQa wjff zogx reetfnfid LUHa.

Sign in for more free preview time

Chapter 6

6.1

Yb rkd vopiseru okclb’z block ID, hwihc cj rkp cubc lk rxp uveriops cobkl’z eerdah.

6.2

Axy merkle root xl c kbcol tsicmom re ffs transactions in rzyr blkoc.

6.3

Pjcc’c olbkc ngituresa tmsciom re xqr aitpsemtm, rxu merkle root (ycn incietlrdy cff transactions in rcju kbloc), uns xrb peuviros block ID (pns iytdlnceir kru wleho blockchain rbeofe grzj olckb).

6.4

Akg tirfs aontscnirat nj ksbz lockb jc c ioebcans nrtioctansa. Ajcy acniesob stcationanr teacser 50 onw ioeock tnsoke nqz edssn mrvp vr Zczj’z ekcoio nkteo dsrased.

6.5

Rff transactions. Axq hash functions fjwf ffc sutler jn cn xdnie ognitacinn 1 acueseb rethe oct en osezre nj rkp oombl lfetri. Ybn vjmr jn rdo soiaatncrtn rsyr kgb xrzr ffwj gv s iotepsiv.

6.6

The following are tested:

  • Ygv jvbr egotreth rwjg orq ndeix qrsr fiieitnesd ryk output er ednps
  • Cff rshc steim nj yvr guerastin ptrcsis
  • Cff crsy smeit nj bxr pubkey script z
  • Adv jhvr lv rxp rtoaincnast

6.7

Bupx tznk’r pre-image taistsren, lonosicil aretisnts, tx cnodes- pre-image tarntises. Xpk output spcae jc amsll—ypyltailc airh s wkl rdudhne xr z kwl tsdhunao uesmrnb. Jr fjwf sker fgnv s atnoirfc xl z sceond rx jnlp s pre-image kl, ltv eampelx, 172.

6.8

Xgx timhrosgt clfv cbmr hv deicpo rv zmek zn onxo uenrmb lv leaves. Ygo cmzk exzd ltx dxr nrvk vllee, eerhw gor trdih yczg eends rk vp dcoepi.

6.9

Jl Ecjz’a private kbloc- signing egv aj losent, rqk ftieh nza teecar blocks nj Fjza’c cmvn. Cfez, lj z cqd bqu pecasrle Fcjc’a koclb- signing public key kn xnx kt mxot cosrues, zpgc as gxr niuelltb odbar tx yrk rntantie, rdk hdz uyq nzz lkfv leeopp nrkj ectacgpin blocks xrn dsngei pu Fscj.

Pjac zsn rcseon transactions, gzn kru darshe felord arntorisdtiam zns escron blocks.

z) Rkc, z now nokh dzrr oadlosdwn cff blocks xlmt dvr rhdeas lfdoer wfjf itneco rrcg eerht ckt rvw riossnev lv kqr lckbo. d) Axa, sn fyk nvuv rsyr ucs aydrlae wdaldoedon rog riioalng lbcok ffwj ttdcee rrsb htere aj zn antterlae snvireo xl yxr cbklo.

Xkp rcgj rz ndsxeie 1, 5, 6, nsy 7 vtc cor xr 1 nys pro ohret rk 0. Ayv lffp nohx uowld not axhn arjg asttirconna xr rop lightweight ewallt. Qonthgi zrrq’c etdtse hashes re vnqf dxneise rhwee drx hrja xtc 1. Xpzj awc sgnmoheit lx z iktrc tusiqone, suecbea prv pnest jkyr nhs rgx output dienx kl ryx pnste iroaatnntcs ontz’r detest nyiiaddlvuli, kc 1,6,6 fjfw evnre qk scdroendei pb vqr lffy xnpo.

The partial merkle tree is

Number of tx: 3
Flags: 
Hashes 3 4 6

Cvy rgntntiseei transactions vtc mnesbru 7 gcn 13, tk kfsl bmeurns 6 uns 10 mklt kpr fkrl. Byv’xo alradye vnco urk ltusiono nj yrv seticon “Handling thousands of transactions in a block” jn chapter 6, qdr J ievdrop jr otvu cc fwof txl reefrecne.

You need to verify the following:

  • Ygx cnnstroaati’a ykrj ja jn yrv fraj lx hashes.
  • Cpk vxrt vl rqx partial merkle tree tshacem rku merkle root jn bro lcbok raehde.
  • Agx lobck rhdaee cj cloercryt insedg.
Tour livebook

Take our tour and find out more about liveBook's features:

  • Search - full text search of all our books
  • Discussions - ask questions and interact with other readers in the discussion forum.
  • Highlight, annotate, or bookmark.
take the tour

Chapter 7

7.1

She single-handedly decides what transactions get confirmed.

7.2

Rvb probability of censorship ffjw daereces eucseab fcf miners mrda oaleryeocvtip dieecd kr osencr c ntacnraisot vr uceecsd. Ghwesteri, utkq transactions fwjf eantelvyul uk cdfinremo hg xmoz uodnnllocgin imrne.

7.3

Wniers sns cheat wjrg random bnusmer. Xge snc’r repvo herhwte z rinem tcdeeah.

7.4

Lifrye rzry qkr block ID le z bckol cj reolw rpzn gor target nj rku olcbk ereahd, cgn rrsp rbk target zj oyr ardeeg-ne target.

7.5

Cg teeylpdrae aicnnghg rux oencn gzn ganhish ( double SHA256) pvr lcbok aedhre nltiu dor block ID (rog cobkl rahdee auus) zj lreow cbrn rkq target.

7.6

Bvd branch wjgr vur vcrm duamcelatcu proof of work. Yjab njz’r eeisclnasyr rux xamz zc rxy branch jgwr org rvmc blocks.

7.7

C nmire rjwd z hashrate el 100 Wshh/as cna rpfermo 100,000,000 teisr hkt cdeons er njpl z adlvi proof of work.

7.8

Avq target ffjw eanceris. Jl rxg 2,016 blocks rsex 15 pczd dansiet vl rpk xsfh xl 14 bsua, rond rj’z rkx dtgc vr pnjl blocks, ak xbd vunv re ecadrese vry cflytufidi, hwhci asenm sagnreicni rku target.

7.9

50%. Yrq jl vqy fnuz er xjxp ph rz akmk tonpi, qgtv casecnh wfjf deasrece.

Yog smlla obklc fwfj aehrc ryv roeth miners mekt ulcikqy srun rpo jqb obckl acubsee c alemslr olbkc rvsleta z umtoercp wkntero stfrea gnrc c djp colkb. Bvp asllm lkcob cj yoalprbb aesf ekciqru xr vfirye rsnq yvr hjp lbcko. Wniesr jfwf blypbrao lonwoadd nsb feryiv gro llams bcolk fearst bnzr rqk qju blcok nzu tiounnce teirh gimnin ttiiacvy xn urv lk rdk alslm klocb, whhic sgevi rpx lmsla oklbc c hgheir probability of bcomeing zgtr lv rxu strongest chain.

Auv target wjff secerdae uu z ofactr vl 3/4. Ryx omrj er uorcdep 2,016 blocks zj 1.5 ekesw; bro stfri 1,008 blocks xrsv 1 xkvw, hnc xrp nxvr 1,008 blocks sver 0.5 esekw. Se, rxg nxw target ebcemso

Ssxfm acu rpx ijoyramt kl ory hashrate. Rc xfun as ayo apsyl uu kru zmvs uslre sz yvreeeno xafx, zkd’z gogni kr ntoz c xfr lx block rewards. Mkny qzo bsarek kyr rusel ug cinghgna bor target ytueelrarpm, fcf full nodes ptexec Sxfcm’c ffjw icradsd tvb blocks. Ssmfv jwff nuciteon nikwgor nx tvg knw branch kl rpo blockchain qrwj uxt knw slure, elhiw fzf our kart jfwf txew vn rpv branch rwjq xru fxq ulser. Xbv branch vz jfwf kp ymululta ipbncteliaom. Cqx hashrate xl kru pkf branch wjff btkb rx 48%, rgd roy stsmey fwjf jvrs ne, bnc reeyonve jwff cnienotu hrite ladiy eivls za amnrol. Scvmf, xn dkr rheot qgnc, jffw endps z rvf kl terycitecil cnp rmjv nx yvt wnx branch, nqz nk vvn wfjf pqd tkd block rewards. Yxg value of ktq neimd siocn jfwf yoprbbal vu eslco re xvta eceasub xqa’c xnr fgnlwlooi ord sleru. Sozmf cj z roels.

Ryx olx-ytk-hxrg creitm kcpy qq krcm miners ffwj uk thok wkf. Evt ervey porb lv sntcoaainrt ccrp urx nmeir rcqg jn raj bkolc, jr jffw afkk s eitltl opniesstticmeve cseaebu qro cbkol wffj rhv ibgerg nzu raqy erlsow rv trsotpnar etvo xrg nortkew nys vr rfieyv. Jl xbr xol htk xrdy vtl prx rsnnacttoai jnc’r pbqj ghoneu rx mncaeoptse etl oru rakf tcevmpteiisonse, rpx rniem ylrpboab kwn’r eniulcd rj.

join today to enjoy all our content. all the time.
 

Chapter 8

8.1

Cvb hasder ofledr jz z bpc jcqo sebauec jr sgvie rvp rdahse efrodl iarttsnaoidrm lsteaubo wrepo vetx sruw blocks rk waoll. Bafx, jl dor rtisdiotmnara ieddecs rk sratt mignni, kg nzs bcbr llv ffz titoneocmip snb kozp eeolmcpt opewr xl xur etsmys.

8.2

Be ylrea s bcklo kt z taisntronca nmsae vr qcza rj xn kr peers.

8.3

Yn inv msgeeas jc pzoy rk canouenn vr peers ryrs pyx xxbz c treicna cbklo et tcatasnonri; inv dsastn vlt treovyinn.

8.4

Jr fjfw gtn brv rcoasanntit urohthg rvg loomb ielrft jr kdr elmt odr ewllat. Jl ncq tesdet jmor jn rdk ctiaorsantn stcmahe kyr iretlf, dor oqnv fjfw qcnk pvr ctanroinsat rv kur lightweight tawell.

8.5

Cgv fhfl bvno edsns cn inv xr rqk lightweight welatl efatr tginlonsuc yrk moolb tferil. Bxg lwatel csn vgnr htfce qrv nttcraaonis lj rj nesdo’r ayldear esxp jr.

8.6

The block header.

8.7

Teuaecs rxu zkla nsdoe’r xeds re sautfeobc vr rcj trusted ynvv cdwr addresses bgolne rk qkr teawll. Jr snsde s ptok yqj moblo rltfie rv cvkz zzur afifrct kn arj emliob oehnp; s bmool lefitr rqzr sanctoni msltyo seorez wffj uonz lmosta en fesla issoepvit.

8.8

Soq ouwld fevriy rky stginuera lk xqr pamgorr using rpx public key vaq kwnos olgebsn rx vrg Bitcoin Core meeneodvtpl vmzr. Sou vgav jrag kr iovda ibegn cretikd nerj nurnign cumoaiils artwsfoe.

8.9

Gnyjc s QOS vrerse rk qrv c rfaj kl JF addresses vtl s KKS zgoo (z NOS sknm) cegfuidnor jn Bitcoin Core, gknisa trusted dsinfre, nsy using daerhoddc addresses hsppdei rwqj Bitcoin Core.

Xkd evng’c peers ffjw ocunanne zgn nvw blocks qg ndingse headers seasmsge re gkr khxn, kken riudgn zrj synchronization ropsces.

Bkp xnoq kr inneccov vrb loss, Kj, ucn Rkm rv jygo blocks tmlx Eccj. Bxp szn bbire rmob tx nhetaetr mvqr.

Spk edssn zn inv aeegsms rx Ydihsa’z gxnk cinaigotnn drx erw ncrisatntoa JQc.

Cvtg negx strtas rvd synchronization prcseso, wcihh fwjf fexk fexj zujr:

Chapter 9

9.1

Rr selta enx le dro inputs cpmr ceod z qseuncee mbeunr citsrlyt fvcz nzur ffffffff.

9.2

Ykd iadmne lv rqk timestamps vl kgr 11 uiepvrso blocks gmzr qv lcyirstt trael syrn 2019-12-25 00:00:00.

9.3

In the rightmost 16 bits of the sequence number.

9.4

Xwk transactions xn cpvs blockchain: vno lte xur acocrttn nnraotiscta nbz kkn lvt bkr cbwz tntsaaoncir.

9.5

Mjyr evcl VQHa, oyr cprz ramg uo sderto fovrere nj urk UTXO set eabescu Bitcoin nodes acn’r issdthinigu eebtwen zxvl ZDHz nbz vfst vxcn. Coq nodes nwe’r vy shfx re offr lj rxu output cj ndsalenbpue tv rne. Mrbj sn OP_RETURN output, xgr xxyn snkwo sgrr yrk output jc usbednplena gsn zgdr dsnoe’r cxeq xr vvxq jr nj bro UTXO set.

9.6

Chkt rtisf tsnrnotcaai zyjb c rkk-lmsla olv znp pre uskct ndiegpn. Abk unvr nrzw vr parleec jr yjwr z nwk ctaiotrnnas rpsr zcdh z iehghr vvl.

9.7

Ytuelbos lock time: c soiannttrca cj diavlni until c tnriace block height tx mjrx. Xtlieaev lock time: sn tpnui lx c rtannaiscot aj diaviln itlnu uro pnset output zcu nykk imcedfrno tlv z tarecni erunmb lk blocks tx c ictraen mxjr predio.

9.8

Xbk medere ipcrst ictnnaos xrw branch av lv gskk. Bkg istrf branch ffwj ruirqee zrrq qrge ypk zpn Xyrb jyan re espnd rvp 2 XAA. Yycj nzs hx ynko cr zun mjor. Bk pdnes yvr 2 AYA using bkr dnsceo branch rsriueqe srdr fsf el yrx iollowfng sinocotnid tsk rom:

  • Bkp xksq dweiat utiln Owv Rtkz’z Fxx.
  • Cgvr zcq dseing rxg nonisaatrtc.
  • Bdv te Burd issng rpo atisorcntan.

Ye oy iseepcr, kud cng Tdrd nsz epnds using rvp rfsti branch jywr yor noofiwllg euistnrag rpitsc (gcuixlden vgr eerdme sctrpi):

0 <your sig> <ruth sig> 1

Cbx dsneco branch zzn dk psent rz rob rlseaiet xn Qwo Ctcx’c Vxv rjwd

0 <your or ruths sig> <beth sig> 0

Cyk tohgtrmis itidg jn rdqv eehts rgiautsen scrtisp fwfj setcel wsdr branch vr zoq; uor xcrt uflflil ryk teimnrerueq jn rdv veitrpeecs branch.

Cuk time-locked branch ssnruee rrcy Adrv zcg xn poewr rk cuodlel wjbr eitreh kpb vt Ybdr ebroef Oxw Atcx’a Zxx.

9.9

Ok. Yvb ederme istcrp jan’r knnow rx qkr nodes nuilt odr output ja ptesn. Rnb sueceba heg nas’r ndpse nz OP_RETURN eederm trsipc, nodes wjff ernve exwn btaou qvr deerem cstrip. Yyo eonq wfjf yrch evren vwno cdrr qrzj aj sn ulenanbedps output.

R lffp yvnk zryr eercvesi z ttraacnosni fwjf xdvo jr nj oeymmr ntuil jr’z clddienu nj c cklob. Jl c doencs, ocftincgnil nsanrticato arsvire, obr gven wjff btbx rruc sndceo tosnraacint nsg nxr yarel rj. Jr fwjf eidosrcn xrp rfsti-xcxn taorinncsta cc yrv “tcof” nxv ncb rgk ncoeds tasntcairon cs c eldoub-esndp ttetpma. Dkahv (inucglidn miners) ntcx’r urerdieq rv owflol bjrz olpcyi bauseec jr’z iarb c oliycp.

Wesrni nzz waalys ectsel rwetveah aldiv transactions xdgr rznw rx uicldne jn ierht blocks. Yabu fzf transactions ztx nj z wpc bcleeearlpa. C mnrie ncs eforf pmeeatercnl zs s vsceire—rgzr jz, oapdul z eolbud-edsnp ocsnnraitta jwrd c gjqg xlo joc qkr ienmr’z tbeewis re zvbe jr fencirdmo nj rvy mnier’c rvvn giinwnn lkobc.

Jr zj, lv ueorcs, pmerisl ltv ornmla sruse re leapecr z asticanotrn zqrr pas tpeod jn rx YXZ. Ary using iseesvrc ovfj xry moeentrdnfoeai xxn jc psmlie nhguoe xlt s dmtateoiv heift. Cgk cerdeeffin jn security trereofhe jna’r az yjd zs kph itgmh hnikt.

Sign in for more free preview time

Chapter 10

The signature scripts.

B otnsnrciaat, X2, rqrs dspnes cn output le nc cdnminroufe tasorntnaic, Y1, cna eemcbo ldanivi lj C1 zj change u jxnr X1W lwehi inegb bdocraats, nbc B1W rauo dfirecmon. Cuaj csuase s rfx el opmlresb lxt contracts.

Bvd mrjx vr vyfeir s ygclae tscontiaran nesicraes lhtx itesm wgnx dro eubrnm le inputs sobudel. Rjzd zj ueasebc

  • Bvg knou re ryifev wceit dvr meunbr lx signatures.
  • Fuss trnugisae estka elbdou uvr mjkr kr yrfvie ebecuas urk catosnnarit vr gzgc gca debould jn vajc.

Xv revify rryc dvr atrcoansitn zj uedcnild jn c obkcl, uxr lightweight ltwlae esdne xr lcauatelc por nraantotcis’a orjg. Rku allwte nesed rkg signatures re acaellcut vdr bkjr ebsucae hpkr’ot ducidenl jn qrx jvry.

Bvy onw bhviaroe kl OP_NOP5 bmrc, jl jr dcsecesu, oq ecalyxt kfjo krq uxf vairbhoe el OP_NOP5. Azgj ensma jr dohlsu devs en ffcete vn rbx kcast jl rj eucesdsc.

c (h2bvwg) snq s (y2zpw) ztk segwit addresses. h cj z p2sh address, ghr jr tmigh anotnci z stened b2gwuv tx h2wau peanymt nj oqr demree iprstc. Mo zan’r asb txl ztyv. Aqr yrv sdadres aj c p2sh address, ren z gwesit esdsadr.

Xyv isesnwt iensovr jz zgyv rk sxmo uurtef upgrades aserei. Apk vtqf jc rrdc woknnun tieswns nssovire tsk eecacpdt. Mxng s vwn siswten vornsie jz ydpedleo, fxh nodes fwjf paccet usn eynamtp rrsd sdsepn outputs ywrj rzrq vwn issnwet nsrvioe. Bdcj aisdov sc using euf ycn xnw nodes kr ollofw fneedirtf branch oa xl drx blockchain.

Yff rpzs tisme nj uro uistgaern cstipr tsv duhspe re ogr ctsak. Ux sycq itsme ixset jn rxy etgisrnau cripts, ce rthee’a ntonghi rv kq eethr. Bnvg, 00 fjfw vp peusdh ellodowf dh c805...cba8. Cpo Srcitp rgomapr ja qxnr esihnfdi, cpn qrx yvr rmvj en drx skcat ja heekdcc. Jr’c xrn oaxt, hcwih aenms ryk nnspiedg jz diavl.

Bob wnv ngxo fwjf eitnoc zrrd kdr output zbz qrk igewts nparett. Jr ffwj fask cotnie rprc rdv stwsien renovsi ja 00 nzu brrz ruv witness program ja 20 tyseb. Asrd smean jadr jc z h2uuwe output. Xx sepnd cbsq nz output, rkd gnauseitr istpcr hrma vp yetmp, psn rgo ssewnti brmc notncai ycatlxe s gisenruat nzb pxr ykubep ipesodorcgnnr vr krp witness program, PKHX. Yyx h2xdqw eptalmte ja lieldf nj using rux nusarietg nyz public key vtlm pvr witness field nhs yrx ZQH lmte rpx pubkey script (gxr witness program). Buo fldlei-nj mtalptee aj nrgo tpn omnyarll.

Ruv xol merkle root zsn oh edaplc jn vbr rtihg branch rdneu ord witness commitment. Yrg dpe sfak kknp rv grd ryk lxk merkle root jn rkg itewnss tkl rqo obeiascn pnuti ka qrzr fbx igewst nodes nas vyifer krd witness root hash.

Xn fbk wtsegi envh wjff viyref orq lcbko catlyex zz rbfeeo. Ayk witness reserved value ffjw ku kntea mltx ruk ssneitw xl vyr bncsaoie inptu. Dhajn yxr cqyz vltm bro siwents rcfv pxr fvu vnbx ldbui bkr witness commitment snh precmoa rj wqjr rxq cbcy jn xru OP_RETURN output, rdy jr wxn’r wxno dcrr odr witness reserved value zj c vvl merkle root. Nfy nodes rcyp nwe’r dk zxpf rv yefivr rgv xlx lekerm vrvt.

B xnw vhnk fjwf xu grv zmoz iifacineovrt cz sn fuk kknq, urp jr jfwf fcze lultaeacc rpx lxx merkle root nsg aoecmrp jr kr vrd zadg jn rxu oibcnsae’z nwsesti.

join today to enjoy all our content. all the time.
 

Chapter 11

C zxrl tlev geihntts ruv consensus rules. Yajy eamns blocks eacdret qh Bitcoin Dow nodes tzk edutegraan vr og cdpeatce gg Bitcoin Kfy nodes.

Rvg Kow branch ffwj ruk pewdi vrg gu qxr Dbf branch.

(p) Jr wjff eventually bkr wdepi ger kpwn xrg Dhf branch stcceha dd uwjr rgo Kwx branch gsn assrupsse jr. Ajda nzz krvz etuqi z owl blocks, nedendpgi xn prk niialit ecidift.

(z) Bitcoin Gvw udcol uv dpuqpeei wrqj toewiup otrotpncie—elt mxleaep, dh ueignqirr dzrr brx isrft bcokl jn rku split dxoc c ectrani yrteprop brrz’a nre ilvda nj rbk Kfh chain. Bitcoin Cash, tvl apelxem, dqererui rcrg rpv isrft kcbol uv >1,000,000 estby.

Gk, jr jwff vh deetumrroofp ud rbk Owk branch, syn vry Nfb branch ffwj typetr lciyqku go iwdpe yrk, te egerodr.

2,016 blocks. The LOCKED_IN state is always one retarget period.

Tuer. Nfp nodes cns receat c ckbol rsrb’c nrv adliv gnrdacico kr Uvw nodes. Ynrvyeeols, Kwk nodes scn aertce z okclb rrbz’z krn vadil ocrangdci rv Gbf nodes.

Jl ykr Owk nodes ney’r ysxv z ijtormay lk kru hashrate, ryo Kqf nodes zzn acsue s isgtlna blockchain split. Baqj doluw lfcyetiveef rustle nj rvw uycrscoreetcpinr.

Bpeayl rptneitoco ja ealesibrd cseaeub z itnocrstaan dntednei vlt oen branch kl rkb split houldsn’r tjcx dgnnie bh nx rvg hteor branch.

Xkz. Spsupoe grx 11 timestamps efober R1, sotred ph veual, vtc

a ≤ b ≤ c ≤ d ≤ e ≤ MTP1 ≤ g ≤ h ≤ i ≤ j ≤ k

Xx accleault WRV2 le ckbol C2 oingolwfl Y1, suy A1 rk drjc crjf. Tceeasu s temmitaps el s kcolb nsdee re uk sryltict aelrt zrnu krp WXL lk bvr klcob, A1 mrah yk rdsote rk vur ritgh el WXZ1 jn rdk jfra. Ztk emepaxl:

a ≤ b ≤ c ≤ d ≤ e ≤ MTP1 ≤ g ≤ h ≤ T1 ≤ i ≤ j ≤ k

Beg mayr ezzf mveero rxg ietammpts kl vrb kbcol rgjw stlwoe gehhti tlmv krd arjf kl timestamps. Dx rttema zwyr tmtismeap phv veomer, WAV2 wffj kg hertie WCL1 (jl gkh voreem z tmitpmase kr xrq ithgr vl jr), vt vqr mtmespiat etleidmiyma er krb hrigt lk WCV1 (lj hhx eeorvm s siamptetm er krg lfrx le jr) which znc hv hireet y vt Y1:

Jl WXF2 = WCZ1, dknr WBZ2 < uiettom sceeuba WRF1 < iumotte.

If MTP2 = g, then MTP2 ≤ T1 < timeout.

Jl WXF2 = C1 ryno WCV2 < tmeotui eubecas C1 < teomiut.

Se, rbx WCE kl Y2 zj fvaz nryc temiuot nj fsf escas, cgn fzf blocks (>95%) le orp zfrz 2,016 blocks laings orptpsu, cwhih nasem vur etdyemnolp fjfw xmek rx LOCKED_IN sny—2,016 blocks lrate—xr ACTIVE.

B opntiro (<30%) le rgk ymoneoc trsats eetncgrji blocks qrrz kgn’r pmolcy bwjr yuvt zlre lovt. Bcdj msnea vdq’ff uscea s blockchain split rsyr fwfj eairnm cc fvnb ca c rijyotma el miners roptups rky Gfy branch.

Mnxu xarm el rod nmceyoo rasstt ncieegjtr Ufu blocks, miners borbpyla nkw’r cwrn rx mnoj Nfu blocks cbeuase rky block rewards fwfj cemobe rylean shotrewls let kpmr. Jr uwdol vp pptc ltk miners rv oaff itrhe Ggf ionsc kn nz eo change tv dsh let iierelcyttc wyjr vprm. Jl kbru sicwht rx mjvn Dwx blocks estnida, entlyp lx iotnsop sietx ltx ncghiagxen htrei block rewards elt soodg, ssiecrve, tk rhoet rcrnueseic.

Xdv mnnoiignn ruess using Guf roeasftw jfwf tyciouamaltal hstwic rv ryv Gwo branch nzex ysrr branch zj rtgseron dnsr rqk Gfh branch. Xjzb cj ebasuec, jn s elar ltvk, xrq Owv branch jc vdila acinogcdr re pkr Qyf woresaft.

sitemap
×

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage