29

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)? There are two components to CVE-2018-17144. There is a crash bug and an inflation bug. Both are triggered by almost the same scenario: a transaction contains an input multiple times. In general, how this would ...


7

2008 We don't know if Satoshi Nakamoto is an individual or a group, but Satoshi Nakamoto asked for professional crypto geeks to review his project in 2008. The original source files were therefore distributed privately through email. 2009 Unsure if Satoshi Nakamoto used any kind of source control before the source codes were available to the public. You ...


4

Satoshi made many design decisions that are now criticized (like signatures in transactions, 2-week difficulty period, halvings, etc..). He also made some maths error in the whitepaper. Satoshi wasn't a perfect designer and his C++ code was not up to the highest standards. We will maybe never know for sure why he chose what he chose, but I'd personally ...


4

Recall that vanitygen allows you to list several patterns and search for addresses that match any of them. It looks to me like for each prefix, we compute the range of hash160 values that, after base58 encoding, would match the desired prefix. (Conveniently, the checksum only affects the end of the address, so we don't have to worry about it.) These ranges ...


4

I see the max coin supply being 21.000.000 (million) under the variable called MAX_MONEY. MAX_MONEY is not what controls the maximum coin supply. It is just a variable for use elsewhere that estimates the coin supply. The actual coin supply is regulated by the halving interval and the starting generation amount. CAmount COIN CAmount CENT The base unit in ...


4

The original Bitcoin code base definitely didn't support this. Currently it's possible to effectively keep the entire UTXO set in memory in Bitcoin Core if you set the database cache large enough (over 6 GB, last I checked). The blockchain itself is always stored on disk.


4

A list of some GitHub alternatives is here. GitLab BitBucket SourceForge Launchpad Google Cloud Source Repositories AWS CodeCommit Phabricator Gogs (Self-Hosted) Gitea (Self-Hosted) Apache Allura (Self-Hosted) This GitHub Repo Full Downloader written by Andrew Chow may also be of interest. Discussion on whether to move from GitHub and where to move to ...


4

Some good places to start are the places that the user or the network input something into Bitcoin Core. The obvious two places for these are the RPC functions and the network message processing. The RPC code is in src/rpc, src/wallet/rpcwallet.cpp and src/rpcdump.cpp. The network message processing is in src/net_processing.cpp. By tracing through the ...


3

extern before function prototypes does not have any effect. If it were a variable, it’d be needed to specify that the variable was declared somewhere else. void noui_connect(); void noui_connect() {/*something*/} ^^^The compiler can easily find which is the prototype and which is the implementation of the same function. However, // main.h int a; // main....


3

That's not quite right. There are two main threads involved in the network code, the network thread and the message handler thread. The network thread receives data from peers, parses it into messages, and puts those messages on per-peer queue for processing. It only serves one peer at a time, but is not restricted to processing full messages. For example ...


3

But how is difficulty changes if suddenly 90% of hash rate disappears* ? It will change as it normally does, after 2016 blocks. There is no provision for adjusting the difficulty if the hashrate suddenly drops. *recent BCH fork had difficulty adjusted quicker than 2016 blocks. As part of their hard fork, they added a provision for cases where blocks are ...


3

How do all million plus users agree to these feature/bug requests? Mostly by deciding whether to continue using Bitcoin-core or switch to one of the many other existing implementations of a Bitcoin wallet. Those who are particularly competent to assess the changes are probably also, in many cases, competent to fork the code base and not introduce changes ...


3

How does Bitcoin get developed? Originally, Bitcoin was developed by its creator, Satoshi Nakamoto. After Nakamoto disappeared in April 2011, the Bitcoin client evolved into the Bitcoin Core project which is now developed by the loosely organized Bitcoin Core contributors. There are also a number of alternative Bitcoin implementations today, but the majority ...


2

idx = index, as in the index of an array/list or similar data structure, usually (and in most cases such as this one) an index is zero-based, meaning the first element of the array has an index of 0, the second has an index of 1, and so on.


2

It is referenced relatively, namely by using the parameter BIP102HeightDelta. The hardfork is 3 months after the block that Segwit was actived and the number of blocks after is equal to 90(days)*144(blocks/day)(https://github.com/btc1/bitcoin/blob/385cbc994f35d36cefdab8c1c00ebfaceb55cfc6/src/chainparams.cpp#L78) Try to look for that parameter. It will ...


2

genesis.GetHash(""); This is incorrect. GetHash does not take a parameter, as said in the compiler error. This should just be genesis.GetHash();. I have checked the debug.log but i dont see new values for hashGenesis and Merkel root. The debug.log file is only modified when you run the program, and because it isn't even compiling, when you run it, you ...


2

The value r is just a number and doesn't explicitly store or encode any point coordinates. In a signature, r is set to the X coordinate of the point R, which is really k*G, where k is the secret nonce used during signing, then reduced mod the curve order. In secp256k1, this usually means that r is in fact the X coordinate (because r itself is usually very ...


2

I'm not sure about "learning the codebase", but I can point you to some files which are in my opinion good starting points for explorations: The init.cpp: "what happens when I start my bitcoind ?" The rpc calls in src/rpc or src/wallet/rpcwallet. For example, "what happens when I sendtoaddress ?" In addition there are also other parts that might be less ...


2

Where in the source code do we check whether hash(blockheader*nonce) < Difficulty The function you are looking for is in pow.cpp: bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params) { bool fNegative; bool fOverflow; arith_uint256 bnTarget; bnTarget.SetCompact(nBits, &fNegative, &...


2

If you have a custodial account with Exchange.blockchain.com, you must contact them for help. They own the money, not you ("Not your keys -- not your bitcoin"). If you have a non-custodial wallet downloaded from Blockchain.com, you should normally recover control over your money by restoring the wallet from a backup or from a safely stored record ...


2

I don't think there is much overlap, beyond the conceptual "making connections between nodes over the internet" part. There are also hash functions in both, and probably a few more very basic constructions.


1

I think that these articles are great for educational purpose: Bitcoin mining the hard way: the algorithms, protocols, and bytes This article explains Bitcoin mining in details, right down to the hex data and network traffic. If you've ever wondered what really happens in Bitcoin mining, you've come to the right place. http://www.righto.com/2014/02/bitcoin-...


1

Memory usage. Adding a vector to each of the (now over 600000) CBlockIndex entries would be a significant memory usage increase (at least 48 bytes per entry, to be precise, on stdc++ 64-bit platforms). For most operations it's also unnecessary. Instead, CChain stores a pointer to all CBlockIndex entries in the main chain, allowing O(1) access to any of ...


1

There are several reasons for this: We don't want a dependency management tool to automatically download software from the web. There is always a risk of some backdoor inserted by someone malicious in case we do not manually verify each 3rd party component. We would like to keep the build scripts as simple and low level as possible to maintain full control ...


1

What you are looking at is just an implementation detail that you really don't need to worry about. It's just converting from an internal format (which may use different coordinate systems and bit lengths, especially for tests) to the standard output format. Within the library itself, the data in the signature may be easier and more efficient to handle when ...


1

Because regtest is supposed to be test network, it has to be pretty similar to mainnet. Thus there really isn't separate code for regtest only, most of the code is shared between the two networks. The differences are really only defined by a few parameter changes which can be found in chainparams.cpp.


1

A possible reason is that Bitcoin Core expects a low S value. Try changing s with N-s if s > N/2 (N is the curve order). Source here


1

First the peer who chooses to connect shares their version. Each of the peers can only send one version message. PushNodeVersion is used to send the version message. It is called by two functions 1) PeerLogicValidation::InitializeNode when the connection is outbound. 2) ProcessMessage when a message is received. It looks like this: bool static ...


1

Your general understanding is correct. Mining doesn't perform any additional checks then any other full node. Mining serves the function of giving transactions an ordering which is difficult to undo, but validation is just a function performed by every node. Some tests are in miner.cpp because creating a block that matches some set of rules needs ...


1

The oldest one is from Feb 14, 2016 but I'm sure historically significant changes to the code were done since. Indeed, date opened is not always a good indication of controversy or significance, it could also mean a change which has received very little review due to its insignificance, or very little rebasing/nit-fixing due to lack of time by the creator. ...


Only top voted, non community-wiki answers of a minimum length are eligible