Bitcoin Forum
June 01, 2024, 02:34:50 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Noob's question on transaction in the block and related source code  (Read 726 times)
altcoinUK (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1000


View Profile
July 23, 2014, 10:44:12 AM
 #1

I have been buying and using bitcoin in the last two years, but was never interested in the technical details and underlying concept. Now I am reading more and more technical materials and being really fascinated by how bitcoin works, what a good technology it is. Unfortunately more reading raises more and more questions. The newest topic I would like to understand how transactions are recorded in the block more precisely what handles that process (putting new transactions into the block). If I understood correctly miners who generate the block will include the incoming transactions in it. According to the wiki, "all peers trying to solve blocks collect the transaction records and add them to the block they're working to solve". My question is which software component does that, is it the bitcoind software or the mining pool would handle that? If the bitcoin core software does that, would you mind to let me know where is that in the source code? Tracking down step by step the process by reading the source I would understand better what's happening under the hood.
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
July 23, 2014, 08:47:57 PM
 #2

Line 84 in miner.cpp is a good place to start (https://github.com/bitcoin/bitcoin/blob/master/src/miner.cpp).

Mind you that some pools may use custom implementations that apply different logic to decide which transactions to include. As long as all transactions included in a block are valid, it is up to the miner to decide exactly what to include and what to leave out.
altcoinUK (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1000


View Profile
July 23, 2014, 09:51:02 PM
 #3

Line 84 in miner.cpp is a good place to start (https://github.com/bitcoin/bitcoin/blob/master/src/miner.cpp).

Mind you that some pools may use custom implementations that apply different logic to decide which transactions to include. As long as all transactions included in a block are valid, it is up to the miner to decide exactly what to include and what to leave out.

Thanks for your reply, that's great and really helpful.

I can see from the source code that the miner try to include transactions from the memory pool. If I understand correctly the main.cpp line 3888 populates the memory pool with transactions. Are these messages with the strCommand value "tx" transactions from p2p clients such my wallet when I send BTC to some one? If yes, does it mean that many miners would include my transaction and the lucky one who finally get the block will put the block that includes my transaction into the block chain?

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!