34
votes
Why is bitcoin written in C++?
The most important reason is that the original Satoshi codebase was written in C++. A system like Bitcoin has extremely strong requirements about consistency in behaviour: all nodes on the network ...
31
votes
How to understand Bitcoin source code
I'm in my final year of college and I remember being in your exact situation 2 years ago. In my view you can adopt 2 strategies at this stage.
You need to understand the protocol first, and reading ...
29
votes
Why is bitcoin written in C++?
I gave a keynote address at cppcon 2016 about almost this exact issue. There are a variety of reasons why C++ is an excellent language choice for blockchain applications like Bitcoin.
Blockchain ...
18
votes
Where is the UTXO data stored?
I assume this question is about Bitcoin Core's internal operations. This description is valid for version 0.8 and later (up to 0.14 at least).
One part of the system deals with the active chain, ...
17
votes
Accepted
Migration from Berkeley DB to LevelDB
As someone who was involved in doing that migration at the time, I believe it was the right decision. LevelDB is far from perfect, but I wouldn't know what else to use.
In particular:
BDB is much ...
16
votes
Accepted
What contributions have Blockstream developers made to the Bitcoin project?
Disclosure: I'm a Blockstream co-founder
Major feature contributions to Bitcoin Core:
Greg Maxwell, Andrew Poelstra and myself (as well as several other contributors) worked on libsecp256k1, a well-...
16
votes
Accepted
What is the tradeoff between privacy and implementation complexity of Dandelion (BIP156)
In my view, the main implementation detail to be worked out with Dandelion
is ensuring that there are no new DoS vectors introduced.
In the existing transaction relay model of Bitcoin Core, ...
16
votes
Accepted
Bitcoin protocol and Wireshark
Someone wrote a Bitcoin protocol decoder for Wireshark, several years ago. I assume it was included in the Wireshark distribution.
Wireshark simply knows about the Bitcoin protocol. There is no magic ...
15
votes
Accepted
Where in Bitcoin Core does it do X?
Introduction
The key to finding out where a piece of code is without already knowing where it is is to start at the thing that will eventually lead to what you want to find. These can be logically ...
15
votes
Accepted
What does Bitcoin policy language offer the developer that Miniscript doesn't? What is the difference between Bitcoin policy language and Miniscript?
Both answers by James C. and sanket1729 are very good, but I wanted to give a very high-level answer:
Miniscript is an intermediate more structured representation for actual Bitcoin Scripts. It is ...
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 ...
14
votes
Why does Bitcoin Core print SHA256 hashes (uint256) bytes in reverse order?
From sipa on IRC (2023-01-06):
jamesob: Probably dumb question, but why does uint256::ToString() (-> HexStr()) print out the blob in reversed byte order?
sipa: Because that's what it has always ...
14
votes
Accepted
Where is the bitcoin source code is the 21 million hard cap stated?
Where is the bitcoin source code is the 21 million hard cap stated?
Nowhere, because there isn't actually a 21 million cap rule.
The relevant code is this:
CAmount GetBlockSubsidy(int nHeight, const ...
13
votes
Accepted
Where can I find resources for programmers to understand Bitcoin?
The book Mastering Bitcoin would be a good solid start (although it might not answer all your questions). It is also available for free.
13
votes
Accepted
Why is Bitcoin Core using LevelDB instead of Redis or SQLite?
Redis and LevelDB solve very different problems. We tried using SQLite and its performance was abysmal.
Bitcoin Core needs a database to store the set of unspent transaction outputs (UTXOs). This ...
13
votes
Accepted
Why is it so hard for alt clients to implement Bitcoin Core consensus rules?
Because they're not known.
This may sound surprising, but you have to realize that Bitcoin's consensus rules are defined by what (economically relevant) full nodes actually enforce. We can assume at ...
12
votes
Accepted
What are the key differences between regtest and the proposed signet?
The main difference between signet and regtest is that signet is an actual network, as opposed to a sandboxed environment.
In regtest, the network topology is entirely manual. You spin up nodes, and ...
12
votes
Accepted
Why many classes in the Bitcoin Core prefix with a `C` while it is prohibited in the developer notes?
These classes predate the coding style guidelines. Guidelines are a recommendation for newly added code and refactoring patches for the purpose of only changing the coding style are discouraged.
In ...
11
votes
How to understand Bitcoin source code
I have a different approach to it. You can use this too.
Bitcoin uses Doxygen comments to explain the code.
You can take the most recent copy of the code, build class hierarchy yourself using ...
11
votes
Accepted
Is there developer documentation for the Bitcoin Core source code?
To understand Bitcoin Core, the best resource is probably the source code itself:
https://github.com/bitcoin/bitcoin
To help understand what is going on in the code, try the developer documentation ...
11
votes
Accepted
Why was the Schnorr code removed from Bitcoin Core?
The Schnorr implementation was never in Bitcoin Core. Rather it is in the libsecp256k1 library that is a subtree in Bitcoin Core. The commit you reference is actually a commit in that library which ...
11
votes
Accepted
What are the debug categories?
net: Networking. All messages related to communicating with other nodes on the network, including what P2P messages were sent and received and to whom and other information about the network messages.
...
11
votes
Accepted
BIP44: What's the use of internal addresses?
The separation between internal and external addresses comes from BIP32.
Using a different chain for each permits you to give out an xpub for just the external ones to an auditor. They would then be ...
11
votes
What does Bitcoin policy language offer the developer that Miniscript doesn't? What is the difference between Bitcoin policy language and Miniscript?
Miniscript doesn't compile down to script. It encodes a subset of all Bitcoin script. It is a (very crafty) template language which reduces the Bitcoin script language to specific script expressions ...
11
votes
What does Bitcoin policy language offer the developer that Miniscript doesn't? What is the difference between Bitcoin policy language and Miniscript?
At a high level:
The policy is compiled to Miniscript.
Miniscript is encoded to Bitcoin Script. (One to One Mapping)
Bitcoin Script is decoded back to Miniscript. (One to One Mapping)
Policy and ...
11
votes
Accepted
Why are transaction input and output indices called `vin` and `vout`?
The original Satoshi codebase used a programming style called "Hungarian notation", where variable names are prefixed with letters that indicate the data type they contain.
v in particular ...
10
votes
Is there a reference, authoritative resource or book on Bitcoin programming?
I was asked by Hasan Hasan, a junior developer, which of the following three books I'd recommend. Personally I think all three books are fantastic (I would recommend them all) but they do approach the ...
10
votes
Accepted
Why is the Bitcoin Core wallet database moving from Berkeley DB to SQLite?
The introduction of descriptor wallets presents an opportunity to introduce a new database backend as descriptor wallets are backwards incompatible. The following is taken from Andrew Chow's blog post ...
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 ...
10
votes
Accepted
Why isn't the taproot deployment buried in Bitcoin Core?
The Taproot deployment is buried insofar as consensus no longer checks its status to determine whether to enforce the Taproot rules. The Taproot rules are enforced from genesis now, with the (...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
bitcoin-core-development × 606bitcoin-core × 227
bitcoind × 83
blockchain × 41
client × 26
c++ × 26
transactions × 25
bitcoincore-review × 23
testing × 21
functional-test × 20
script × 19
taproot × 19
p2p × 18
block × 17
development × 17
source-code × 17
wallet × 15
consensus × 13
debugging × 13
bitcoin-cli × 12
protocol × 11
altcoin-development × 11
transaction-fees × 10
hash × 10
python × 10