Questions tagged [source-code]

70 questions
20
votes
1 answer

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)? Why can't this be done by a non-miner? Also, which forks are/were vulnerable?
hedgedandlevered
  • 1,407
  • 1
  • 9
  • 22
10
votes
2 answers

In 2009, where were Bitcoin source codes stored?

Now I can see the Bitcoin Core source code in Github but I wonder where the original source code of Bitcoin were stored back in 2009? Was it managed under SVN? How did contributors or programmers work together back then? Thanks, Pil
Sungpil Han
  • 225
  • 2
  • 12
7
votes
2 answers

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

I'm doing some deeper research into historical consensus changes and it seems like most folks consider the addition of the OP_NOP codes to be a hard fork. Here's the diff for their addition:…
Jameson Lopp
  • 161
  • 7
7
votes
0 answers

Satoshi's coding quality

I have little knowledge about C++, so I want to ask two questions from "expert" (C++) programmers here: Why Satoshi wrote Bitcoin in C++ and not in (for example) C language? any technical reasons? OOP? just a personal choice? How good is the…
Fang
  • 71
  • 1
6
votes
2 answers

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

In the bitcoin source code in txmempool.h, a comment says that unconfirmed transactions are indexed by five criteria: * mapTx is a boost::multi_index that sorts the mempool on 5 criteria: * - transaction hash (txid) * - witness-transaction hash…
3
votes
2 answers

What is a good approach to learning the Bitcoin codebase?

I've read Mastering Bitcoin and other high level resources and I believe I have a decent understanding of Bitcoin. I'd now like to read and understand the source code. However, I'm very new to cpp and don't know a good way to approach this task. Is…
Matthew Cruz
  • 428
  • 4
  • 15
3
votes
1 answer

How is bitcoind "shy" when exchanging `version` packets?

This is more of a technical/programming question. I am referring to this line of code: https://github.com/bitcoin/bitcoin/blob/be992701b018f256db6d64786624be4cb60d8975/src/net_processing.cpp#L1699 I understand the logic behind not sending a version…
Tedy S.
  • 87
  • 3
3
votes
1 answer

ThreadOpenConnections and break versus continue: why the one versus the other?

In the inner loop of ThreadOpenConnections() in net.cpp sometimes there is a break to the outer loop and sometimes a continue. This is my understanding of the decision between break and continue in this part of the code: A break fully 'restarts'…
codo
  • 31
  • 2
3
votes
1 answer

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

I was reading this article about bitcoin-core. It is an explanation of bitcoin-core source code version 0.3, and it described a file named main.cpp. In the recent versions this file does not exist (or at least I couldn't find it). And based on the…
Amir reza Riahi
  • 1,133
  • 7
  • 22
3
votes
1 answer

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

I'm not sure even this question is off-topic or not. But bear with me. Currently I have a good knowledge of bitcoin protocol and network but know very little about its source code and implementation but want to contribute to the project. So I…
2
votes
1 answer

Bitcoin ECDSA signature in the compact format

I would like to understand how to get Bitcoin ECDSA signature in a compact format, when it's exactly 65 bytes. In the bitcoin-core repository, secp256k1_ecdsa_recoverable_signature_load is responsible for this. As far as I understand, in it r and s…
Oroffe
  • 125
  • 4
2
votes
3 answers

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

I am writing transactions manually and have stumbled across a rather bizarre situation. Only one in a few of the transactions I broadcast to bitcoind is accepted, otherwise I get a REJECT_NONSTANDARD (Non-canonical DER signature). So I got my hands…
Tedy S.
  • 87
  • 3
2
votes
1 answer

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

I've been trying the find the code in Vanitygen that does checks whether the generated address starts with the expected pattern. Vanitygen repo: https://github.com/samr7/vanitygen What I currently know: vg_output_match_console is called when the…
MCCCS
  • 10,097
  • 5
  • 27
  • 55
2
votes
1 answer

BTC Source code amount.h file

I have question about the source code, under src/amount.h I see the max coin supply being 21.000.000 (million) under the variable called MAX_MONEY. I want to ask what other variables mean, CAmount COIN CAmount CENT And I want to know how they're…
2
votes
0 answers

Clarification of some getaddr() function inputs and outputs

In the Bitcoin system to discover new nodes, each node communicates with its peers by sending getaddr() to the peers. Based on the bitcoin implementation: //! the maximum percentage of nodes to return in a getaddr call #define…
1
2 3 4 5