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
Has the Hulk always been able to talk?
Emotional immaturity of comic-book version of superhero Shazam
What does "Managed by Windows" do in the Power options for network connection?
Can my company stop me from working overtime?
Why are UK Bank Holidays on Mondays?
In Stroustrup's example, what does this colon mean in `return 1 : 2`? It's not a label or ternary operator
Why does sound not move through a wall?
Find the cheapest shipping option based on item weight
How to safely wipe a USB flash drive
Why do people keep telling me that I am a bad photographer?
Upside-Down Pyramid Addition...REVERSED!
What was Bran's plan to kill the Night King?
Can I use a fetch land to shuffle my deck while the opponent has Ashiok, Dream Render in play?
Should I decline this job offer that requires relocating to an area with high cost of living?
Something that can be activated/enabled
IP addresses from public IP block in my LAN
Point of the Dothraki's attack in GoT S8E3?
Are Finitely generated modules over a ring also finitely generated over a subring containing the identity?
Can FreeNAS zfs send to a Linux machine?
Are pressure-treated posts that have been submerged for a few days ruined?
How to increase the size of the cursor in Lubuntu 19.04?
List of newcommands used
Causes of bimodal distributions when bootstrapping a meta-analysis model
Decoupling cap routing on a 4 layer PCB
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 2 hours 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 2 hours 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