Where in Bitcoin Core does it do X?Ubuntu bitcoin PPABitcoin core does not have all unconfirmed...
Wrong answer from DSolve when solving a differential equation
Building a list of products from the elements in another list
Should I mention being denied entry to UK due to a confusion in my Visa and Ticket bookings?
How to safely wipe a USB flash drive
How to adjust tikz picture so it fits to current size of a table cell?
How to increase the size of the cursor in Lubuntu 19.04?
Can my 2 children 10 and 12 Travel to the USA on expired American Passports? They are US citizens
Where can I go to avoid planes overhead?
Find the cheapest shipping option based on item weight
What exactly are the `size issues' preventing formation of presheaves being a left adjoint to some forgetful functor?
ZSPL language, anyone heard of it?
Adjacent DEM color matching in QGIS
Did we get closer to another plane than we were supposed to, or was the pilot just protecting our delicate sensibilities?
Word meaning as function of the composition of its phonemes
What was Bran's plan to kill the Night King?
SafeCracker #3 - We've Been Blocked
In Russian, how do you idiomatically express the idea of the figurative "overnight"?
Has the Hulk always been able to talk?
I need a disease
Floor of Riemann zeta function
Understanding trademark infringements in a world where many dictionary words are trademarks?
Where in Bitcoin Core does it do X?
How do inspiraling black holes get closer?
Has a commercial or military jet bi-plane ever been manufactured?
Where in Bitcoin Core does it do X?
Ubuntu bitcoin PPABitcoin core does not have all unconfirmed transactionsWhat versioning scheme does Bitcoin Core follow?Migration from Berkeley DB to LevelDBWhere does the Bitcoin Core code serialize the number of transactions?Merkle Root and Merkle ProofsWhat are the exact steps for creating a transaction and having a valid block?Where can one find the Bitcoin core roadmap?Do bitcoind and bitcoin-qt resume blockchain downloading from the same place?Exception CompactSize when I parsering a nuimbar od the blk file >= 976
Note that this is a general question and answer designed to serve as a guide for finding things in Bitcoin Core.
Where in Bitcoin Core's source code does it do X? How can I find that code by myself?
Example questions:
- Where does Bitcoin Core determine if a transaction is valid?
- Where is the Proof of Work checked?
- Where is the code for transaction creation?
bitcoin-core bitcoincore-development
add a comment |
Note that this is a general question and answer designed to serve as a guide for finding things in Bitcoin Core.
Where in Bitcoin Core's source code does it do X? How can I find that code by myself?
Example questions:
- Where does Bitcoin Core determine if a transaction is valid?
- Where is the Proof of Work checked?
- Where is the code for transaction creation?
bitcoin-core bitcoincore-development
add a comment |
Note that this is a general question and answer designed to serve as a guide for finding things in Bitcoin Core.
Where in Bitcoin Core's source code does it do X? How can I find that code by myself?
Example questions:
- Where does Bitcoin Core determine if a transaction is valid?
- Where is the Proof of Work checked?
- Where is the code for transaction creation?
bitcoin-core bitcoincore-development
Note that this is a general question and answer designed to serve as a guide for finding things in Bitcoin Core.
Where in Bitcoin Core's source code does it do X? How can I find that code by myself?
Example questions:
- Where does Bitcoin Core determine if a transaction is valid?
- Where is the Proof of Work checked?
- Where is the code for transaction creation?
bitcoin-core bitcoincore-development
bitcoin-core bitcoincore-development
asked 1 hour ago
Andrew Chow♦Andrew Chow
34.4k42562
34.4k42562
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Introduction
The key to finding out where a piece of code is without already knowing where it is is to start at the thing that will eventually lead to what you want to find. These can be logically thought through. For example, for relay and validation, these all occur after a node has received a block or transaction, so begin at the point where a block or transaction is received.
There are generally three kinds of actions that Bitcoin Core does: validation and relay of blocks and transactions, the wallet, and startup
Validation and relay
In order for Bitcoin Core to be able to validate and relay a block or transaction, it has to first receive it. So logically the place to begin looking is at the point where a block or transaction has been received and it is beginning to be processed. That is in ProcessMessages
function in src/net_processing.cpp
. Within this function, there are several if
statements for each type of network message that can be received.
For transactions, you want to look at the if
block for NetMsgType::TX
. By reading through the code in this if
block and following the functions that are called, you will eventually reach where a transaction is verified, added to the mempool, and relayed. The most important function within this block is AcceptToMemoryPool
and that is where all of the validation for an unconfirmed transaction is done.
For blocks, you want to look at the if
block for NetMsgType::BLOCK
. Reading through this code will lead you to ProcessNewBlock
and later ActivateBestChain
and ConnectTip
which are the functions that contain the validation of blocks.
The wallet
Almost all of the wallet's functionality is centered around the creation and receiving of transactions. These logically begin when the user wants to send Bitcoin. So a good starting place is the sendtoaddress
RPC. Following this function will take you to CreateTransaction
and later SelectCoins
which are responsible for transaction creation and coin selection.
Some other things that are interesting in the wallet would include wallet creation and loading which occurs in CreateWalletFromFile
and wallet encryption and unlocking which have good starting points of the encryptwallet
RPC and walletpassphrase
RPC
Startup and initialization
Lastly some interesting occur during startup such as DNS seeding, connecting to nodes, loading the blockchain from disk, etc. The obvious and actual starting point is the main
function. The main function is the entry point for pretty much every C/C++ program so it's a good place to look at for startup. Following the main function will bring you to AppInitMain
which is where the bulk of loading and initialization occurs.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "308"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f87450%2fwhere-in-bitcoin-core-does-it-do-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Introduction
The key to finding out where a piece of code is without already knowing where it is is to start at the thing that will eventually lead to what you want to find. These can be logically thought through. For example, for relay and validation, these all occur after a node has received a block or transaction, so begin at the point where a block or transaction is received.
There are generally three kinds of actions that Bitcoin Core does: validation and relay of blocks and transactions, the wallet, and startup
Validation and relay
In order for Bitcoin Core to be able to validate and relay a block or transaction, it has to first receive it. So logically the place to begin looking is at the point where a block or transaction has been received and it is beginning to be processed. That is in ProcessMessages
function in src/net_processing.cpp
. Within this function, there are several if
statements for each type of network message that can be received.
For transactions, you want to look at the if
block for NetMsgType::TX
. By reading through the code in this if
block and following the functions that are called, you will eventually reach where a transaction is verified, added to the mempool, and relayed. The most important function within this block is AcceptToMemoryPool
and that is where all of the validation for an unconfirmed transaction is done.
For blocks, you want to look at the if
block for NetMsgType::BLOCK
. Reading through this code will lead you to ProcessNewBlock
and later ActivateBestChain
and ConnectTip
which are the functions that contain the validation of blocks.
The wallet
Almost all of the wallet's functionality is centered around the creation and receiving of transactions. These logically begin when the user wants to send Bitcoin. So a good starting place is the sendtoaddress
RPC. Following this function will take you to CreateTransaction
and later SelectCoins
which are responsible for transaction creation and coin selection.
Some other things that are interesting in the wallet would include wallet creation and loading which occurs in CreateWalletFromFile
and wallet encryption and unlocking which have good starting points of the encryptwallet
RPC and walletpassphrase
RPC
Startup and initialization
Lastly some interesting occur during startup such as DNS seeding, connecting to nodes, loading the blockchain from disk, etc. The obvious and actual starting point is the main
function. The main function is the entry point for pretty much every C/C++ program so it's a good place to look at for startup. Following the main function will bring you to AppInitMain
which is where the bulk of loading and initialization occurs.
add a comment |
Introduction
The key to finding out where a piece of code is without already knowing where it is is to start at the thing that will eventually lead to what you want to find. These can be logically thought through. For example, for relay and validation, these all occur after a node has received a block or transaction, so begin at the point where a block or transaction is received.
There are generally three kinds of actions that Bitcoin Core does: validation and relay of blocks and transactions, the wallet, and startup
Validation and relay
In order for Bitcoin Core to be able to validate and relay a block or transaction, it has to first receive it. So logically the place to begin looking is at the point where a block or transaction has been received and it is beginning to be processed. That is in ProcessMessages
function in src/net_processing.cpp
. Within this function, there are several if
statements for each type of network message that can be received.
For transactions, you want to look at the if
block for NetMsgType::TX
. By reading through the code in this if
block and following the functions that are called, you will eventually reach where a transaction is verified, added to the mempool, and relayed. The most important function within this block is AcceptToMemoryPool
and that is where all of the validation for an unconfirmed transaction is done.
For blocks, you want to look at the if
block for NetMsgType::BLOCK
. Reading through this code will lead you to ProcessNewBlock
and later ActivateBestChain
and ConnectTip
which are the functions that contain the validation of blocks.
The wallet
Almost all of the wallet's functionality is centered around the creation and receiving of transactions. These logically begin when the user wants to send Bitcoin. So a good starting place is the sendtoaddress
RPC. Following this function will take you to CreateTransaction
and later SelectCoins
which are responsible for transaction creation and coin selection.
Some other things that are interesting in the wallet would include wallet creation and loading which occurs in CreateWalletFromFile
and wallet encryption and unlocking which have good starting points of the encryptwallet
RPC and walletpassphrase
RPC
Startup and initialization
Lastly some interesting occur during startup such as DNS seeding, connecting to nodes, loading the blockchain from disk, etc. The obvious and actual starting point is the main
function. The main function is the entry point for pretty much every C/C++ program so it's a good place to look at for startup. Following the main function will bring you to AppInitMain
which is where the bulk of loading and initialization occurs.
add a comment |
Introduction
The key to finding out where a piece of code is without already knowing where it is is to start at the thing that will eventually lead to what you want to find. These can be logically thought through. For example, for relay and validation, these all occur after a node has received a block or transaction, so begin at the point where a block or transaction is received.
There are generally three kinds of actions that Bitcoin Core does: validation and relay of blocks and transactions, the wallet, and startup
Validation and relay
In order for Bitcoin Core to be able to validate and relay a block or transaction, it has to first receive it. So logically the place to begin looking is at the point where a block or transaction has been received and it is beginning to be processed. That is in ProcessMessages
function in src/net_processing.cpp
. Within this function, there are several if
statements for each type of network message that can be received.
For transactions, you want to look at the if
block for NetMsgType::TX
. By reading through the code in this if
block and following the functions that are called, you will eventually reach where a transaction is verified, added to the mempool, and relayed. The most important function within this block is AcceptToMemoryPool
and that is where all of the validation for an unconfirmed transaction is done.
For blocks, you want to look at the if
block for NetMsgType::BLOCK
. Reading through this code will lead you to ProcessNewBlock
and later ActivateBestChain
and ConnectTip
which are the functions that contain the validation of blocks.
The wallet
Almost all of the wallet's functionality is centered around the creation and receiving of transactions. These logically begin when the user wants to send Bitcoin. So a good starting place is the sendtoaddress
RPC. Following this function will take you to CreateTransaction
and later SelectCoins
which are responsible for transaction creation and coin selection.
Some other things that are interesting in the wallet would include wallet creation and loading which occurs in CreateWalletFromFile
and wallet encryption and unlocking which have good starting points of the encryptwallet
RPC and walletpassphrase
RPC
Startup and initialization
Lastly some interesting occur during startup such as DNS seeding, connecting to nodes, loading the blockchain from disk, etc. The obvious and actual starting point is the main
function. The main function is the entry point for pretty much every C/C++ program so it's a good place to look at for startup. Following the main function will bring you to AppInitMain
which is where the bulk of loading and initialization occurs.
Introduction
The key to finding out where a piece of code is without already knowing where it is is to start at the thing that will eventually lead to what you want to find. These can be logically thought through. For example, for relay and validation, these all occur after a node has received a block or transaction, so begin at the point where a block or transaction is received.
There are generally three kinds of actions that Bitcoin Core does: validation and relay of blocks and transactions, the wallet, and startup
Validation and relay
In order for Bitcoin Core to be able to validate and relay a block or transaction, it has to first receive it. So logically the place to begin looking is at the point where a block or transaction has been received and it is beginning to be processed. That is in ProcessMessages
function in src/net_processing.cpp
. Within this function, there are several if
statements for each type of network message that can be received.
For transactions, you want to look at the if
block for NetMsgType::TX
. By reading through the code in this if
block and following the functions that are called, you will eventually reach where a transaction is verified, added to the mempool, and relayed. The most important function within this block is AcceptToMemoryPool
and that is where all of the validation for an unconfirmed transaction is done.
For blocks, you want to look at the if
block for NetMsgType::BLOCK
. Reading through this code will lead you to ProcessNewBlock
and later ActivateBestChain
and ConnectTip
which are the functions that contain the validation of blocks.
The wallet
Almost all of the wallet's functionality is centered around the creation and receiving of transactions. These logically begin when the user wants to send Bitcoin. So a good starting place is the sendtoaddress
RPC. Following this function will take you to CreateTransaction
and later SelectCoins
which are responsible for transaction creation and coin selection.
Some other things that are interesting in the wallet would include wallet creation and loading which occurs in CreateWalletFromFile
and wallet encryption and unlocking which have good starting points of the encryptwallet
RPC and walletpassphrase
RPC
Startup and initialization
Lastly some interesting occur during startup such as DNS seeding, connecting to nodes, loading the blockchain from disk, etc. The obvious and actual starting point is the main
function. The main function is the entry point for pretty much every C/C++ program so it's a good place to look at for startup. Following the main function will bring you to AppInitMain
which is where the bulk of loading and initialization occurs.
answered 1 hour ago
Andrew Chow♦Andrew Chow
34.4k42562
34.4k42562
add a comment |
add a comment |
Thanks for contributing an answer to Bitcoin Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f87450%2fwhere-in-bitcoin-core-does-it-do-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown