Questions tagged [c++]

General purpose programming language.

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

c++ code how to restore wallet keys from mnemonic seed phrase

so iam trying to code some wallet functions in c++ i need to do the following. starting with a seed phrase restore the private keys and bitcoin addresses (all addresses generated from the seed phrase)...
0
votes
1answer
59 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 ...
0
votes
0answers
68 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) cant seem to hash the header correctly. This is the block which I am testing: ...
1
vote
1answer
29 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 ...
6
votes
1answer
118 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 ...
5
votes
2answers
737 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 ...
1
vote
0answers
43 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....
1
vote
2answers
183 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,...
0
votes
2answers
297 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....
0
votes
1answer
78 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.
1
vote
1answer
131 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 ...
2
votes
2answers
83 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 ...
2
votes
1answer
63 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-...
3
votes
1answer
137 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 ...
2
votes
2answers
286 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 ...
1
vote
1answer
159 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 ...
0
votes
0answers
33 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 ...
0
votes
1answer
58 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 ...
1
vote
1answer
207 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 ...
0
votes
1answer
104 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 ...
0
votes
1answer
2k views

Looking for code generate bitcoin address from passphase in C++

i'm try to write a program which generate bitcoin address from given hash sha256 of passphase as private key or given hex private key. I've found a library for this but it required Boost package in ...
0
votes
1answer
134 views

find a CTransaction from a prevout in Bitcoin source code

I'm trying to come up with this function: CTransaction getTxFromPrevout(COutPoint prevo); The idea being... when a new transaction is about to be validated, it will go through all of it's tx.vin[i]....
0
votes
1answer
433 views

bitcoin compile (.undefined reference to **')

I'm getting error after make command like, undefined reference to `BlockAssembler::BlockAssembler(CChainParams const&)' and in last Makefile:774: recipe for target 'all-recursive' failed make:...
1
vote
0answers
32 views

Failing to create a new address to be used for receiving staking rewards whenever a generated block is accepted [closed]

Our problem is that we need to get a new address on each stake. What I've tried so far is: Generating a new address right before a block is accepted and try using it to receive the stakes, but that ...
0
votes
1answer
279 views

Parse scripts to extract address [duplicate]

I want to parse a script with c++ to gain an output address from it. can anybody introduce a suitable library or a sample code which extract addresses from scripts ?
0
votes
1answer
491 views

How can I create uncompressed public key in C++?

I need to derive public key from my private key in uncompressed form. I know how to create compressed one with libbitcoin, but I can't find appropriate method for uncompressed form there. Are there ...
1
vote
0answers
76 views

I'm trying to compile Bitcoin Gold but i'm still getting this error [closed]

In file included from ./addrman.h:14:0, from net.h:10, from miner.cpp:18: miner.cpp: In member function ‘std::unique_ptr BlockAssembler::CreateNewBlock(const CScript&,...
3
votes
1answer
2k views

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 ...
0
votes
2answers
364 views

C++ error building a fork of Bitcoin-ABC

I'm creating a Bitcoin-ABC based altcoin, everything was fine when I compiled dynamically for my Ubuntu machine, but when I try making a static release build I get: CXXLD libbitcoinconsensus.la ....
1
vote
2answers
759 views

Encountering “ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)” error when I ran modified litecoin chainparams.cpp

First: I am a newbite to altcoin development, next to generate an altcoin from litecoin, 1- I have made a clone of litecoin using git clone https://githubcom/litecoin-project/lotecoin.git 2- I changed ...
1
vote
1answer
977 views

How to debug bitcoin core in “real time”

I am new to bitcoin core and C++ I downloaded already the project from: https://github.com/bitcoin/bitcoin and run "makefile" command. Now I can make all transaction against the blockchain. I want ...
-1
votes
2answers
954 views

Altcoin fork tutorial

Is there any tutorial for altcoin fork creation? I've found only tutorials for the very old versions, and any for the current ones.
0
votes
1answer
158 views

Where does the Bitcoin Core code serialize the number of transactions?

I've been studying the Bitcoin Core code, and I noticed that it uses a template READWRITE to serialize data structures for storing blocks. But it never seems to actually call "READWRITE(nTxs)", the ...
0
votes
1answer
347 views

A short program to mine a block

Anyone can give step-by-step explanation about the code below (if possible, with a c/c++ equivalent)? import hashlib, struct ver = 2 prev_block = "...
0
votes
2answers
619 views

What is most efficient way to validate bitcoin target (difficulty) value in C++

I have two values 1. h = hash of the block (32 bytes long in memory representation - not hex) 2. bits (uint32_t) To make the calculation easier we create a function difficulty such that: auto d = ...
1
vote
1answer
146 views

bitcoind json-rpc interface specification

Is there any document out there on the internet describing how access the json-rpc interface of the bitcoind daemon? In my case, my application is written with C++, and I want access this interface ...
1
vote
1answer
747 views

Question about retarget system bitcoin, add hardcodet block to exist blockchain

the standard values if (nActualTimespan < params.nPowTargetTimespan/4) nActualTimespan = params.nPowTargetTimespan/4; if (nActualTimespan > params.nPowTargetTimespan*4) ...
1
vote
0answers
192 views

G++ Trouble compiling litecoin on ubuntu server AMD64 (Version 16.04 Xenial)

I've been trying to compile litecoin for some time but keep getting an area that reads (/home/User/Downloads/Litecoin/src/leveldb/libleveldb.a: error adding symbols: Malformed archive collect2: error:...
0
votes
1answer
142 views

Been reading the bitcoin source code but unsure what this segment of Serialize.h does

I decided to learn about crypto (and C++) by first reading the entire C++ implementation of bitcoin. I'm having issue with this segment of serialize.h template<typename Stream, typename I> void ...
1
vote
0answers
310 views

make: *** No rule to make target 'all'. Stop. Stellar-core [closed]

I followed the instructions on how to install the stellar core but when I ran make install, I got this error: make: *** No rule to make target 'all'. Stop. I configured it and everything worked ...
0
votes
1answer
536 views

Simulator bitcoin miner

I was checking this C++ mining project to start with Bitcoin mining and understand better how mining works. This is the project: https://github.com/gavinandresen/bitcoin_miningsim But now i want to ...
4
votes
1answer
1k views

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 ...
1
vote
2answers
2k views

C++ and secp256k1

I am working on a tiny C++ bitcoin application for a university project. I'm using Blockcypher API to create transactions, but I faced a problem with signing transaction's hash that returns one of the ...
30
votes
4answers
37k views

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 ...
2
votes
1answer
354 views

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 ...
0
votes
1answer
199 views

How to access peer's tip of chain?

In case I'm a selfish miner and have successfully forked the blockchain, I'd like to know the state of progress of my honest nodes at any given time - how can I achieve this? Do peers on separate ...
2
votes
2answers
64 views

Two if's before sending an inventory message

Going through main.cpp I couldn't completely understand the purpose of a double barrier coded as if-statements: I'm referring to ... if (pto->setInventoryKnown.count(inv)) and if (pto->...
1
vote
1answer
289 views

Block Broadcasting - Unsolicited Block Push

Can someone, please, direct me to the source code section(s) relevant for an Unsolicited Block Push as described in the Bitcoin Developer Guide? I've been going through main.cpp and searched for the ...
0
votes
1answer
217 views

Call function for block n on blockchain

I've been going through main.cpp in order to roughly find out which function calls the best block and I found out depending on situation there are several similar-sounding function names and code ...
-1
votes
1answer
166 views

“Array& params”: How to understand “&” after “Array” - type modifer?

I'm trying to understand how "invalidateblock"-function works, literally line by line. Since I'm at basic level in C++, I couldn't explain to myself what's the "&" after "Array" there to achieve ...