Questions tagged [mastering-bitcoin]

“Mastering Bitcoin” is a book by Andreas M. Antonopoulos giving an introduction to the fundamental concepts and technical details of Bitcoin. Mastering Bitcoin was published in 2014, and an updated 2nd Edition was published in 2017.

The first edition “Mastering Bitcoin: Unlocking Digital Cryptocurrencies” was published in December 2014 by O'Reilly Media. A second edition titled “Mastering Bitcoin: Prgramming the Open Blockchain” was published in July 2017, also by O'Reilly Media.

Mastering Bitcoin was created per an opensource process and is licensed under a CC BY-SA 4.0 license. The source code of the book can be found on GitHub.

23 questions
8
votes
5 answers

checksum = SHA256(SHA256(prefix+data)) - why double hashing?

From 'Mastering bitcoin' - checksum = SHA256(SHA256(prefix+data)) The 'data' is, for example, an address, which was calculated using SHA256 and then RIPEMD160. Why do we need double hashing when calculating the checksum?
Rony Tesler
  • 299
  • 1
  • 8
6
votes
1 answer

How does copying main stack prevent malformed unlocking scripts vulnerabilities?

https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch06.asciidoc In the original bitcoin client, the unlocking and locking scripts were concatenated and executed in sequence. For security reasons, this was changed in 2010, because of a…
Huy
  • 195
  • 6
3
votes
1 answer

Bitcoind with -txindex=1 still no mempool transactions

I'm reading through Mastering Bitcoin and trying to follow along the examples. When I first initialized bitcoind, I set txindex=1 in my bitcoin.conf file. In a later example I was unable to getrawtransaction which failed with the error No such…
Aleksander
  • 133
  • 5
2
votes
1 answer

BIP32 HD Wallets: HMAC vs. "just" Hashing the Seed

In A. Antonopoulus' Mastering Bitcoin (2nd edition) on page 106, there is a nice illustration showing how the basis for a BIP32 HD Wallet is generated: So here is the one thing I don't understand about it: In the middle of the picture there is the…
Dalit Sairio
  • 639
  • 4
  • 12
2
votes
1 answer

What is 'spendability of coinbase transaction after 100 blocks' in Mastering Bitcoin referring to?

Ch7 of the book writes at the end of the Introduction section: "After 100 blocks back there is so much stability that the coinbase transaction—the transaction containing newly mined bitcoins—can be spent" Can someone explain what is the author…
user2065276
  • 275
  • 1
  • 2
  • 7
2
votes
1 answer

What is criteria of mining priority except for transaction-fee?

I am reading "Mastering Bitcoin written by Andreas" and I found this explanation of mining. Transactions are added to the new block, prioritized by the highest-fee transactions first and a few other criteria. Source: [Mastering Bitcoins: Mining…
2
votes
1 answer

What is the length of the extended public key?

I'm reading the Master Bitcoin book and I'm a bit confused. The confusion is related to the length of the extended keys. The book says that extended keys are 512 or 513 bits long. It is clear to me that the length of the extended private key is 512…
Filip
  • 423
  • 8
2
votes
1 answer

DoS attack and MAX_BLOCKS_IN_TRANSIT_PER_PEER

I was reading Mastering Bitcoin and I found, in the section Exchanging "Inventory", this: "The node keeps track of how many blocks are "in transit" per peer connection, meaning blocks that it has requested but not received, checking that it does…
Paro
  • 185
  • 6
2
votes
1 answer

Using more than a 12 word mnemonic phrase

From Mastering Bitcoin: "From a security perspective, the amount of entropy actually used for the production of HD wallets is roughly 128 bits, which equals 12 words. Providing more than 12 words produces additional entropy which is unnecessary, and…
1
vote
1 answer

(Mastering Bitcoin) When sending a raw transaction, why is the receiver included in the details hash as a "send" transaction?

I'm working my way through Mastering Bitcoin. The author made a transaction to send 0.05 BTC from one address to another (http://chainquery.com/bitcoin-api/getrawtransaction/ae74538baa914f3799081ba78429d5d84f36a0127438e9f721dff584ac17b346/1) In the…
Huy
  • 195
  • 6
1
vote
2 answers

Extended Public Key 's mechanism misinterpreting in 'Mastering Bitcoin' by Andreas

I am a newbie and start exploring from the 'Mastering Bitcoin' book. The figure below to me is a little inaccurate, I think the arrow from HMAC-SHA256 should point right to the child public key. Am I right??
1
vote
2 answers

Create Pay to Witness Script Hash in Pay to Script Hash Address

I'm trying to generate a multisignature, segwit compatible address as a P2WSH nested in BIP16 P2SH as described in BIP141. Basically, I want to construct a P2WSH-nested-in-P2SH address from n public keys and the m required to sign a valid tx. (m…
1
vote
1 answer

A problem on difficulty equation

When I read this book Master Bitcoin, I have a problem in understanding the "Difficulty" in Chapter 8. There is a equation of difficulty: New Difficulty = Old Difficulty * (Actual Time of Last 2016 Blocks / 20160 minutes) I feel…
Ello
  • 13
  • 4
1
vote
2 answers

How was 59 days determined with 1 TH/sec from "Mastering Bitcoin"

In Mastering Bitcoin in the section on Difficulty Bits Andreas notes: This means that a valid block for height 277,316 is one that has a block header hash that is less than the target. In binary that number would have more than the first 60 bits…
cloudnthings
  • 437
  • 3
  • 8
1
vote
1 answer

Question about Payment Channels

I was reading the book Mastering Bitcoin written by Andreas about state channels for fast payment processing. There was a part named "Asymmetric Revocable Commitments" that said: given an ongoing state channel, one party can use a "revoke key" to…
1
2