30 votes
Accepted

How does the most recently found critical vulnerability (CVE-2018-17144) work?

If you were a miner, what are the steps you would take to create the extra (21,000,012.5th) bitcoin? Where in the source code is this exactly (link)? There are two components to CVE-2018-17144. There ...
Ava Chow's user avatar
  • 70.5k
15 votes
Accepted

What is the purpose of indexing the mempool by these five criteria?

The mempool is the short-term memory of a full node. We use its content e.g. to: exchange information with peers build block templates estimate feerates track pending payments to our wallet The ...
Murch's user avatar
  • 75.4k
10 votes

What is the purpose of indexing the mempool by these five criteria?

Just adding onto Murch's answer, which does a great job at explaining the uses of each index. But I can't understand the need for sorting them based on txid and wtxid (while they are hash output, so ...
glozow's user avatar
  • 313
8 votes
Accepted

In 2009, where were Bitcoin source codes stored?

2008 We don't know if Satoshi Nakamoto is an individual or a group, but Satoshi Nakamoto asked for professional crypto geeks to review his project in 2008. The original source files were therefore ...
Chak's user avatar
  • 1,301
7 votes

Was the addition of OP_NOP codes in Bitcoin 0.3.6 a hard or soft fork?

When the script interpreter encounters an unknown opcode (the default: case inside the switch statement), it returns false. That aborts verification and considers the transaction to be invalid. This ...
Pieter Wuille's user avatar
7 votes

Why Bitcoin Core source code use #include bracket syntax instead of quote syntax

Double quotes means that the compiler will search for the include relative to the source file. Angle brackets means the compiler will search only the include paths. By using angle brackets and ...
Ava Chow's user avatar
  • 70.5k
5 votes
Accepted

Why does the bitcoin client send transaction's txid and wtxid in 'inv' process?

Wtxid relay was introduced in BIP339, where you'll find more details on the rationale and design. Whenever a node supports BIP339, it will advertize that to its peers, through the wtxidrelay ...
Pieter Wuille's user avatar
4 votes
Accepted

Why did Satoshi not choose for Segwit?

Satoshi made many design decisions that are now criticized (like signatures in transactions, 2-week difficulty period, halvings, etc..). He also made some maths error in the whitepaper. Satoshi wasn't ...
alcio's user avatar
  • 1,274
4 votes
Accepted

(Shouldn't be too hard) Where vanitygen checks if the random address starts with the expected pattern?

Recall that vanitygen allows you to list several patterns and search for addresses that match any of them. It looks to me like for each prefix, we compute the range of hash160 values that, after ...
Nate Eldredge's user avatar
4 votes
Accepted

BTC Source code amount.h file

I see the max coin supply being 21.000.000 (million) under the variable called MAX_MONEY. MAX_MONEY is not what controls the maximum coin supply. It is just a variable for use elsewhere that ...
Ava Chow's user avatar
  • 70.5k
4 votes

Is the entire blockchain kept in memory?

The original Bitcoin code base definitely didn't support this. Currently it's possible to effectively keep the entire UTXO set in memory in Bitcoin Core if you set the database cache large enough (...
Pieter Wuille's user avatar
4 votes

What are some of the GitHub alternatives that you consider for Bitcoin Core and other Bitcoin related projects?

A list of some GitHub alternatives is here. GitLab BitBucket SourceForge Launchpad Google Cloud Source Repositories AWS CodeCommit Phabricator Gogs (Self-Hosted) Gitea (Self-Hosted) Apache Allura (...
Michael Folkson's user avatar
4 votes
Accepted

What is a good approach to learning the Bitcoin codebase?

Some good places to start are the places that the user or the network input something into Bitcoin Core. The obvious two places for these are the RPC functions and the network message processing. The ...
Ava Chow's user avatar
  • 70.5k
4 votes
Accepted

Is commenting on github as reviewer good place to ask questions about source code?

I think you'll get different perspectives on this from different people depending on how "basic" we are talking, the PR author and whether the PR is high priority and already obtaining a lot ...
Michael Folkson's user avatar
4 votes
Accepted

where does the main.cpp moved to in recent versions?

main.cpp was primarily split into net_processing.cpp and validation.cpp. However, over the years, parts of main.cpp were moved out of it and into many other files.
Ava Chow's user avatar
  • 70.5k
4 votes
Accepted

What is CCoinsCacheEntry in the Bitcoin Core?

Bitcoin Core uses a hierarchy of "UTXO set views": The on-disk database The UTXO database as it exists on disk The global in-memory cache An in-memory cache with UTXOs that have been read ...
Pieter Wuille's user avatar
4 votes

Are crypto servers updated with code in transactions?

Bitcoin node operators will either Make it a habit to keep a look out for new versions of the software they are using and update their software (after reversible testing if they are sensible) or ...
RedGrittyBrick's user avatar
3 votes

where in the source code is the the proof of work checking the blockheader hash and nonce?

Where in the source code do we check whether hash(blockheader*nonce) < Difficulty The function you are looking for is in pow.cpp: bool CheckProofOfWork(uint256 hash, unsigned int nBits, const ...
JBaczuk's user avatar
  • 7,388
3 votes

Who approves the feature and bug code reviews in Bitcoin?

How do all million plus users agree to these feature/bug requests? Mostly by deciding whether to continue using Bitcoin-core or switch to one of the many other existing implementations of a Bitcoin ...
RedGrittyBrick's user avatar
3 votes
Accepted

Why was 'extern' used in the noui.h file?

extern before function prototypes does not have any effect. If it were a variable, it’d be needed to specify that the variable was declared somewhere else. void noui_connect(); void noui_connect() {/...
MCCCS's user avatar
  • 10.2k
3 votes

Is it true that only one message can be sent at a time in Bitcoin Core?

That's not quite right. There are two main threads involved in the network code, the network thread and the message handler thread. The network thread receives data from peers, parses it into ...
Pieter Wuille's user avatar
3 votes
Accepted

Bitcoin difficulty re targeting in case of catastrophic hashrate drop?

But how is difficulty changes if suddenly 90% of hash rate disappears* ? It will change as it normally does, after 2016 blocks. There is no provision for adjusting the difficulty if the hashrate ...
Ava Chow's user avatar
  • 70.5k
3 votes
Accepted

Who approves the feature and bug code reviews in Bitcoin?

How does Bitcoin get developed? Originally, Bitcoin was developed by its creator, Satoshi Nakamoto. After Nakamoto disappeared in April 2011, the Bitcoin client evolved into the Bitcoin Core project ...
Murch's user avatar
  • 75.4k
3 votes

Was the addition of OP_NOP codes in Bitcoin 0.3.6 a hard or soft fork?

There is nothing to suggest in the code diff you linked to that older clients ignored unknown opcodes in script execution and effectively treated them as OP_NOPs. That doesn't guarantee they didn't of ...
Michael Folkson's user avatar
3 votes
Accepted

Early version of bitcoin and poker

How can we locate the code for an online poker game in version 0.1.0 of Bitcoin The article you linked to, refers to https://sourceforge.net/p/bitcoin/code/1/tree//trunk/uibase.cpp At line 6 is a ...
RedGrittyBrick's user avatar
2 votes
Accepted

Definition of `Idx`

idx = index, as in the index of an array/list or similar data structure, usually (and in most cases such as this one) an index is zero-based, meaning the first element of the array has an index of 0, ...
Eric Allam's user avatar
2 votes
Accepted

Where's the code related to block 494784 for segwit2x?

It is referenced relatively, namely by using the parameter BIP102HeightDelta. The hardfork is 3 months after the block that Segwit was actived and the number of blocks after is equal to 90(days)*144(...
Bjarne Magnussen's user avatar
2 votes
Accepted

How to Create New Genesis Block?

genesis.GetHash(""); This is incorrect. GetHash does not take a parameter, as said in the compiler error. This should just be genesis.GetHash();. I have checked the debug.log but i dont see new ...
Ava Chow's user avatar
  • 70.5k
2 votes

Bitcoind does not like ECDSA (r, s) pair produced by OpenSSL

A possible reason is that Bitcoin Core expects a low S value. Try changing s with N-s if s > N/2 (N is the curve order). Source here
Mike D's user avatar
  • 3,569
2 votes

What is a good approach to learning the Bitcoin codebase?

I'm not sure about "learning the codebase", but I can point you to some files which are in my opinion good starting points for explorations: The init.cpp: "what happens when I start my bitcoind ?" ...
Antoine Poinsot's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible