Questions tagged [c++]

General purpose programming language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
25 views

What is the implementation of PBKDF2 in bitcoin? [closed]

I'm trying to understand how bitcoin works by writing my own code in C++. Currently I'm struggling to correctly implement PBKDF2 function. I've tried so many sources of information, like: PBKDF2 in ...
Kamil Parda's user avatar
0 votes
0 answers
69 views

Can we get together a group of C++ devs that work on Bitcoin apps?

I've been trying to get into Bitcoin development and I've been having a horrible time. I tried multiple Bitcoin-related IRC channels for support but most responded with hostility, except for the ...
13fcali's user avatar
0 votes
1 answer
101 views

How to get block height from CTransactionRef object in Bitcoin C++ code?

I'm working with the Bitcoin core code. I have a CTransactionRef object and I'm trying to determine what the block height of the block containing the transaction is. What would be the most efficient ...
danosphere's user avatar
0 votes
1 answer
198 views

How to use the base58 in c++

its been a while after i done with my python bitcoin miner And i realize that python is slower to do mining stuff, so i decided to rebuild it in c++ as you guys know c++ the faster than other ...
just.callme.client's user avatar
1 vote
3 answers
151 views

What protocol do bitcoin nodes use to talk to each other?

I assume it's TCP, but is there some other software used to send and receive data? So how would I program a very simple C++ program that sends a test message to a node?
apchrkey's user avatar
1 vote
1 answer
103 views

Is it possible to use the getboolarg function in interpreter.cpp

I'm looking to use the GetBoolArg() function in the interpreter.cpp file what changes do I have to make for it to work? I'm still new to development c, I tried several #include but without success. ...
Retro_pex's user avatar
  • 117
2 votes
0 answers
42 views

What is the difference between chain and chainman in the NodeContext in the Bitcoin Core?

In the NodeContext structure there are two members named chainman and chain. chainman is instance of ChainstateManager and chain is instance of interfaces::Chain. What is the differences between these ...
Amir reza Riahi's user avatar
2 votes
1 answer
153 views

What is the nBits field in the CBlockHeader class?

In the source code for the CBlockHeader class, there is a field called nBits. /** Nodes collect new transactions into a block, hash them into a hash tree, * and scan through nonce values to make the ...
Amir reza Riahi's user avatar
6 votes
1 answer
2k views

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 ...
Amir reza Riahi's user avatar
1 vote
1 answer
216 views

Do I have to worry about endian swapping when calculating ECDSA public key values, Creation & Signing of transactions and verification of signature?

Do I have to worry about endian swapping when calculating ECDSA public key values, Creation & Signing of transactions and verification of signature? This question is more of a straightforward yes/...
AncientTides's user avatar
1 vote
1 answer
92 views

How does AttachChain function works in the Bitcoin Core?

Here in the function AttachChain there is block of code: // Unless allowed, ensure wallet files are not reused across chains: if (!gArgs.GetBoolArg("-walletcrosschain", ...
Amir reza Riahi's user avatar
1 vote
1 answer
98 views

Help explaining some C++ code I haven't seen before [closed]

I'm studying for the upcoming pr review club. if (!m_foreign_outputs.empty()) { std::string s(m_foreign_outputs.size(), 0); for (auto i = m_foreign_outputs.size(); i--...
Kaizen's user avatar
  • 331
2 votes
1 answer
240 views

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

Why Bitcoin Core source code use #include <rpc/wallet.h> bracket syntax instead of #include "rpc/wallet.h" quote syntax. Can intellisense C++ editors understand this option and not ...
Bitcoin_1o1's user avatar
2 votes
2 answers
213 views

How can I configure Vim to work with bitcoin core C++ source code and have Intellisense like functionality?

I use Vim for editing, I installed Conquer Of Completion (COC) plugin and now I can edit C++ projects with Vim taking advantage of syntax highlighting, autocompletion, inline error messages, etc. But ...
Bitcoin_1o1's user avatar
7 votes
2 answers
561 views

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: https://...
Jameson Lopp's user avatar
1 vote
2 answers
228 views

What is the actual working implementation code used in double hashing a block header in c++?

I need to successfully generate a hash value based on what i feel so far has been described as a hexadecimal filtered sha256 implementation... or something like that. I've been here , here , here, ...
AncientTides's user avatar
1 vote
2 answers
5k views

Proper way to get sha256 hash in c++ using openssl?

Given the following variables: unsigned char text [] = "Test String"; unsigned int len = strlen ((const char*) text); unsigned char hash [SHA256_DIGEST_LENGTH]; Is there any reason to do ...
Zephyrus's user avatar
  • 772
1 vote
1 answer
2k views

How to generate private/public key pairs in c++ using openssl

I have 2 questions: How can I generate private/public key pairs with c++ and openssl? I don't want them saved to a file. I want the values to be available to my c++ program. Given a private key, how ...
Zephyrus's user avatar
  • 772
4 votes
1 answer
204 views

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 ...
Arnor's user avatar
  • 83
-1 votes
2 answers
120 views

How do i create/implement a midstate function (One that can accurately calculate the midstate of already mined blocks)

I'm creating an AI controlled bitcoin miner but I'm having trouble manually & locally creating a midstate function to be used for optimizing the mining process. Basically I've created independent ...
AncientTides's user avatar
3 votes
0 answers
1k views

Compiling bitcoin error : A compiler with support for C++17 language features is required

I am reading the "Mastering bitcoin: Programming the Open Blockchain" book by Andreas Antonopolous. In the chapter about compiling bitcoin, the instructions were to execute first ./autogen....
Pranay Reddy's user avatar
3 votes
1 answer
173 views

Why does the chacha20 implemented in the Bitcoin Core use a 64 bit nonce?

The draft of chacha20 uses a 64-bit nonce, but the final version of chacha20 specification uses a 96-bit nonce. The #9792 PR adds chacha20 to Bitcoin Core. We can see the function ChaCha20::SetIV(...
siv2r's user avatar
  • 33
2 votes
0 answers
129 views

Version message C++

I learn bitcoin and I am trying to send a version message and get response, respectevily, by using C++. I can not find any examples or articles how to do it in C++. I'm forming request and send it by ...
Mephistopheles's user avatar
1 vote
0 answers
26 views

Which wallets support French seed-phrases? [duplicate]

I found an old backup seedphrase but it is has French words in it, and I've been struggling to find wallet to restore it as it seems most wallets support only English. There has to be a wallet that ...
Moe's user avatar
  • 11
0 votes
1 answer
59 views

What does net_processing cover conceptually in the Bitcoin Core codebase?

What does net_processing (.h and .cpp) cover conceptually in the Bitcoin Core codebase?
Michael Folkson's user avatar
1 vote
1 answer
158 views

Translate c++ function into python: sha256 hash mismatch [closed]

This is not related to bitcoin but it uses most of the bitcoin codebase. I would like to translate some c++ code into python but struggle really hard to get the hashes right. This is the function I ...
Chris's user avatar
  • 113
1 vote
0 answers
134 views

Use wallet db for locked UTXOs in Bitcoin Core

Related question: Why are UTXO locks stored in memory only? Sorry this maybe a dumb question for people good with using database in C++ however I am not able to understand what exactly is going wrong ...
user avatar
1 vote
1 answer
106 views

What do the classes ChainstateManager, CChainState, CChain and BlockManager do in Bitcoin Core?

What do the classes ChainstateManager, CChainState, CChain and BlockManager do in Bitcoin Core? Why do CChainState and CChain have a leading 'C', but ChainstateManager and BlockManager don't? These ...
Michael Folkson's user avatar
1 vote
1 answer
186 views

What is cs_main? Why is it called cs_main?

What is cs_main? Why is it called cs_main? This question was asked during the May 12th 2021 Bitcoin Core PR review club hosted by John Newbery on a Carl Dong PR to de-globalize ChainstateManager. (The ...
Michael Folkson's user avatar
1 vote
1 answer
105 views

What does validation cover conceptually in the Bitcoin Core codebase?

What does validation (.h and .cpp) cover conceptually in the Bitcoin Core codebase? This question was asked by Larry Ruane at the May 12th 2021 Bitcoin Core PR review club on a Carl Dong PR to de-...
Michael Folkson's user avatar
0 votes
1 answer
387 views

how to hash block header in c++

I want to hash a block header in C++ but dont know how. Im just using a test block at the moment, so that I know what the expected outcome is. https://www.blockchain.com/btc/block/669892 I have a ...
Martin Bradley's user avatar
3 votes
1 answer
398 views

How do I hash header block with C++

So im trying to hash a header in C++ and I am having some trouble. I have tried different libraries (cryptopp, openssl) can't seem to hash the header correctly. This is the block which I am testing: ...
Martin Bradley's user avatar
1 vote
1 answer
66 views

Feasibility of using Ring Signatures with CoinJoin Technique

There is a Ring Signature implementation in C++ by Libbitcoin team. We can find the details in the following GitHub repository. Is it feasible to use Monero like Ring Signatures together with the ...
Gokul Alex's user avatar
6 votes
1 answer
510 views

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 ...
Tony Sanak's user avatar
  • 1,689
6 votes
2 answers
949 views

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 ...
John Smith's user avatar
1 vote
0 answers
88 views

How can I add the MySQL C++ connector to Bitcoin Makefile?

I'm trying to add a custom function to my bitcoin client that queries a mysql db. I followed this guide for the basic: https://technology.finra.org/code/compile-run-customize-your-own-bitcoin-client....
JJJ's user avatar
  • 11
1 vote
2 answers
531 views

How to get block height, if I have only block header?

Imagine I executed ReadBlockFromDisk and now I have valid instance of CBlock. How do I read height of this block? CBlock block = ...; CBlockIndex index(block); assert (index.nHeight != 0); // fails,...
warchantua's user avatar
0 votes
2 answers
608 views

Problem to link to libsecp256k1 on ARM architecture

Trying to compile with g++ -o addr 69_addr2.cpp $(pkg-config --cflags --libs libbitcoin) is getting me this error: /usr/bin/ld: /home/pi/libbitcoininstall/lib/libsecp256k1.a(libsecp256k1_la-secp256k1....
bomben's user avatar
  • 518
0 votes
1 answer
383 views

where can I get resource such as Blockchain technology in C++

I have found a lot of pdf files about Ethereum smart contract and JavaScript cryptocurrency. I still want to know about resources such as C++ cryptocurrency. Let me know about some good resources.
kyaw swar's user avatar
1 vote
2 answers
366 views

Was libbitcoin a part of bitcoin core in the past?

I am trying to use c++ code from the book of Antonopoulos for some time now and I seem to lack an include named bitcoin/bitcoin.hpp. To compile the code the g++ compiler gets a pkg-config input with ...
bomben's user avatar
  • 518
2 votes
2 answers
158 views

Is writing unit tests a good way to start contributing to Bitcoin core?

I'm considering writing unit tests to Bitcoin core as a first step to C++ development and Bitcoin contribution. Anyone have any suggestions about the journey I'm about to begin and possible files that ...
João Grilo Bitcoinheiro's user avatar
2 votes
1 answer
134 views

How to understand wallets?

I'm trying to generate a mnemonic seed, and everything that goes with that. I'm using c++ / libbitcoin, using the following code - https://github.com/libbitcoin/libbitcoin-system/wiki/Examples-from-...
btcq4u's user avatar
  • 21
3 votes
1 answer
240 views

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 ...
bomben's user avatar
  • 518
2 votes
2 answers
711 views

Bitcoin value as int64_t or as double

I want to do program that doing some calculations with bitcoin values. I know bitcoin have 8 digits after decimal point (please correct me). If I store the value as double I worry that I might lose ...
Nick's user avatar
  • 211
1 vote
1 answer
215 views

Bitcoin compilation error: conflicting declaration

I'm trying to compile the Bitcoin source (1) on Ubuntu and I get: In file included from bench/data.cpp:10:0: ./bench/data/block413567.raw.h:1:40: error: conflicting declaration ‘const unsigned char ...
givanse's user avatar
  • 230
0 votes
0 answers
47 views

add mysql dependency configure.ac bitcoin

i am working on bitcoin code, my aim is to move blockchain data to relational db but i am not able to resolve mysql dependency for different platform, platform includes mac and ubuntu. I have tried ...
Talha Malik's user avatar
0 votes
1 answer
127 views

Where is the code which rejects transactions with insuffisent balance?

Simple question but I can’t find the answer again. Where is the code which rejects transactions when the value of inputs is below the value of outputs (because I think to recall that check works like ...
user2284570's user avatar
1 vote
1 answer
305 views

How happens the serealization the data in the file blkxxxx.dat in the bitcoin

I'm writing a blockchain parser for bitcoin core with C++ and now I want to enrich the data I read with the raw transaction and the previous and next block hashes. I used this library to convert the ...
vincenzopalazzo's user avatar
1 vote
1 answer
168 views

Why future Bitcoin Core release shouldn't be in python?

Python offers various advantages including simplified rules of coding and ease of readability. It offers OOP, cross platform compatibility and has numerous libraries that have been added over time. It ...
Ugam Kamat's user avatar
  • 7,398
0 votes
1 answer
151 views

How to get amount in RPC

I am developing a bitcoin wallet for education purposes, and i'm working on a getbalance method that given an address i return the balance of the address. Problem is, when communicating via the RPC ...
Haim's user avatar
  • 1