Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c++]

General purpose programming language.

0
votes
1answer
48 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
64 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
41 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
17 views

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

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
0answers
58 views

How can i create rpc json format for my altcoin

How can i create rpc json format for my altcoin ? is there any open source web url ? Sample link: btc-cce-1.coinomi.net:5001 {"jsonrpc": "2.0", "error": {"code": -32700, "message": "cannot decode ...
0
votes
1answer
76 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 ?
2
votes
1answer
179 views

How does bitcoin functional test framework work?

Could someone explain how and where in the code the bitcoin test framework calls map to C++ bitcoin core code or RPC calls such that regression suite tests the bitcoin core functionality? Background ...
0
votes
1answer
303 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 ...
0
votes
0answers
46 views

Can stratum protocol be used in mining softwares that is intended for Altcoins?

I'm curious whether stratum protocol can also be used in mining softwares intended for Altcoins like XMR. I'm wondering if how do applications like XMRig gets the information they need on a pool to ...
1
vote
0answers
57 views

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

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
1k 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
199 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
1answer
385 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 ...
0
votes
1answer
595 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 ...
0
votes
0answers
345 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
83 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
248 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
372 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
103 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 ...
0
votes
0answers
41 views

Quick technique to determine the correct thread(s) which were(was) receiving arguments from bitcoin-cli rpc client when debugging bitcoind

Just as what the title said, what is the efficient way of debugging the multi-thread application(bitcoind/bitcoin-qt) since I found it hard to determine the correct thread(s) which were(was) receiving ...
1
vote
1answer
444 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
137 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
110 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
244 views

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

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
427 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 ...
5
votes
1answer
840 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
1k 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 ...
19
votes
3answers
22k 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
216 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
163 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
60 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
220 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
165 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
146 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 ...
4
votes
1answer
575 views

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

How do I create release build of my new bitcoin wallet?

I have created a new alt coin, and now I want to create a executable of my wallet in ubuntu. I don't know how to create a release build wallet with all its dependencies. How I can build my wallet ...
1
vote
0answers
103 views

Bitcoin-qt doesn't get a server connection?

I have created a new altcoin, and I run a server on one machine and connect bitcoin-qt on another machine. In this case it's blink the network connection, sometimes it shows one connection and after ...
0
votes
1answer
307 views

How can I remove the charity features in my Devcoin clone?

I'm trying to produce a SHA256 altcoin which is merge mined with Bitcoin. I'd like to use some recent code, rather than base in on a 0.8.* or earlier codebase. I've found this source: https://github....
0
votes
1answer
141 views

Decode blocks received and Store in another file for analyzing

I am working on a bitcoin research project. I want to decode receiving blocks from the block chain and store decoded data in a separate file for analyzing purposes. For this purpose I digs the ...
-1
votes
1answer
198 views

We need help with Reddcoin C++ - 1 btc bounty for solution [closed]

We need some help with Reddcoin. We had a bug in our code, 2 lines were commented so the verification of block we’re not done properly. https://github.com/reddcoin/reddcoin/commit/...
3
votes
1answer
2k views

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

Simple GPU C++ mining

I'm trying to mine a genesis block for an experimental Peercoin clone. I've already written one using boost threads, and it's been really fun since this is the most processor intensive program I've ...
1
vote
1answer
347 views

In the sourcecode, what does this line mean that recovers the key from the signature?

I understand that the public key (Q) can be extracted from a signature (r,s), but I'm having trouble understanding this line: if (!key.Recover(hash, &vchSig[1], (vchSig[0] - 27) & ~4)) The ...
0
votes
1answer
912 views

Simple GPU miner with long pooling C++

I want to write own GPU miner, but I can't find any simple solution (cgminer and RPC miner are big projects with many useless to me functions). I need the sources of only one GPU miner with long ...
4
votes
2answers
818 views

Is there bitcoin algorithms flowcharts or any other diagrams available?

To make those who not familiar with C++ to understand the algorithms.
7
votes
3answers
3k views

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 ...
1
vote
1answer
579 views

What is main.cpp for in bitcoind? [closed]

What does the main.cpp source-code file do? I know what main.cpp files are for in general, but specifically in the case of bitcoin?