Questions tagged [c++]

General purpose programming language.

General purpose programming language.

91 questions
35
votes
4 answers

How to understand Bitcoin source code

I am not a C++ pro. I read C++ as a part of my undergrad school course. I am very passionate about the future currency i.e. Bitcoin. But I don't understand the source code structure. How to read the source code? As I already told I am have very…
abhimanyuaryan
  • 455
  • 1
  • 5
  • 7
29
votes
2 answers

Why is bitcoin written in C++?

What made the core developers choose C++ as the main programming language for implementing bitcoin? Was this because of their personal preference? Or another reason?
Vincent
  • 391
  • 1
  • 3
  • 6
7
votes
3 answers

Can I send message inside the transactions script?

I would like to send transactions with messages as described in the wiki. In Transaction with slightly changed script is never relayed, someone answered that non-standard transactions are not relaid by the client. I was wondering if this will affect…
Omar Alriyami
  • 81
  • 1
  • 3
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
6
votes
1 answer

Parameters in UpdateTip - calculation of log2_work

I looked up log2_work inside main.cpp and I can't follow its calculation by log(chainActive.Tip()->nChainWork.getdouble())/log(2.0). a) What is -> explicitely indicating? (I'm at basic level of C++) b) And what is log2_work exactly saying? Does it…
Aliakbar Ahmadi
  • 1,625
  • 1
  • 11
  • 22
6
votes
1 answer

Why many classes in the Bitcoin Core prefix with a `C` while it is prohibited in the developer notes?

It's part of the developer notes in the documentation of Bitcoin Core: Class names, function names, and method names are UpperCamelCase (PascalCase). Do not prefix class names with C. See Internal interface naming style for an exception to this…
Amir reza Riahi
  • 1,133
  • 7
  • 22
6
votes
1 answer

What version of C++ is used in Bitcoin Core?

I can't find the information on which C++ version is being currently used in bitcoin core project? Is it decided for future releases somehow? How does the situation looks now? The only thing I could find was Pieter Wuille's comment: Bitcoin Core is…
Tony Sanak
  • 1,654
  • 4
  • 22
6
votes
2 answers

Is it doable to supplant the current Bitcoin Core implementation with another rewritten in a different language?

Can Bitcoin Core be rewritten in another language, let's say Rust, and could such an implementation supplant the current one in C++ without the users of Bitcoin experiencing some sort of reset/lost of funds? Languages come and go and I was thinking…
John Smith
  • 542
  • 2
  • 11
4
votes
2 answers

Is there bitcoin algorithms flowcharts or any other diagrams available?

To make those who not familiar with C++ to understand the algorithms.
user3855
  • 41
  • 1
4
votes
1 answer

Transaction signature algorithm

As I know, standard ECDSA digital signature algorithm returns two values (according to this article or Wikipedia), but transaction push services or APIs, like this one, require one string as a signature. Can anyone explain, what is that string, and…
Guest_User
  • 63
  • 1
  • 4
4
votes
1 answer

What is the function of LOCK(cs_main)?

Does LOCK(cs_main) pause and branach the program in order to do some necessary job before going on? I'm trying to publish blocks reactively (as a selfish miner) upon receipt of inventory message from pfrom and react to it after *pfrom* catches up…
Aliakbar Ahmadi
  • 1,625
  • 1
  • 11
  • 22
4
votes
2 answers

How to interact with bitcoind using C++?

I know that bitcoind is written in C++, but I cannot figure out how to use its API within my program. I have been using a Python wrapper effectively, but I need another process running that is as quick as possible. Is there a library somewhere for…
Matthew Darnell
  • 508
  • 1
  • 4
  • 12
4
votes
1 answer

Why is CAmount a signed integer?

Is there is reason why Bitcoin uses signed instead of unsigned integers for amounts? I can't imagine a scenario where negative amounts could come up. Was it simply something Satoshi implemented for some future use this way and now we are stuck with…
Arnor
  • 83
  • 4
3
votes
1 answer

How to update an older C++ code from Antonopoulos' book to work with current libraries?

I am trying to compile a code in C++ from the Book "Mastering Bitcoin" by Antonopoulos (page 69). I am new to all of this, including C++, python, etc. I see it as a way of doing something interesting and alongside it learning a bit about different…
bomben
  • 498
  • 2
  • 4
  • 11
3
votes
1 answer

Forking PIVX - ERROR: CheckBlockHeader() : proof of work failed

I have forked PIVX and generated new genesis block hash, merkle root and nonce, and changed the rewards parameters. It compiles fine and the daemon starts, I have even got 2 nodes connected, but attempting to mine the first block with setgenerate…
Shane Buckley
  • 31
  • 1
  • 2
1
2 3 4 5 6 7