Bitcoin Forum
December 03, 2016, 07:50:01 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Satoshi Client Operation: Transaction Exchange  (Read 4863 times)
bitrick
Member
**
Offline Offline

Activity: 64


View Profile
September 06, 2011, 03:57:31 AM
 #1

Satoshi Client Operation: Transaction Exchange
---------------------------------------------------------

The Satoshi client advertises locally generated transactions and relays
transactions from other nodes. This article describes the operations
that deal with this exchange of transactions.

See this article for more information on how transactions are validated:
https://en.bitcoin.it/wiki/Protocol_rules#.22tx.22_messages


-- Wallet Send --

The client periodically calls SendMessages() (in main.cpp) which calls
ResendWalletTransactions to send transactions generated locallly.
This routine looks to see if there has been a new block since last time,
and if so, and the local transaction are still not in a block,
then the transactions are sent to all nodes.
This is done only about every 30 minutes.

Transactions are only rebroadcast if they have a timestamp at least
5 minutes older than the last block was received. They are sorted
and sent oldest first.[1]


-- Periodic Advertisement --

The client periodically calls SendMessages() (in main.cpp) which
determines if a message should be sent to a remote node.
For each message processing iteration, one node is chosen as the
"trickle node".[2]  This node is the only one chosen to receive
an "addr" message, if appropriate.[3]

In the section for inventory, the client sends 1/4 of the transaction
inventory, determined randomly [4], UNLESS they are the trickle node,
in which case they receive ALL transactions.[5] Yes that seems reversed,
but it is what it is. If the node is to receive 1/4 (not all), then the
code also avoids sending any transactions that came from the local
wallet.[6]  The comments indicate this is intended to increase privacy.



-- Relay --

When the client receives a transaction via a "tx" messages,
it calls RelayMessage, which calls RelayInventory, which queues the
inventory to be sent to all other nodes.[7]



Footnotes
----------

 1. See CWallet::ResendWalletTransactions in wallet.cpp.
 2. See:
       pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())];
      ... and ...
       SendMessages(pnode, pnode == pnodeTrickle);
    in ThreadMessageHandler2() in net.cpp.
 3. See:
        //
        // Message: addr
        //
        if (fSendTrickle)
        { 
    in SendMessages() in main.cpp.
 4. See:
       bool fTrickleWait = ((hashRand & 3) != 0);
    in SendMessages() in main.cpp.
 5. See:
        // trickle out tx inv to protect privacy
        if (inv.type == MSG_TX && !fSendTrickle)
        {   
    in SendMessages() in main.cpp.
 6. See:
        // always trickle our own transactions
        if (!fTrickleWait)
        {   
            CWalletTx wtx;

            if (GetTransaction(inv.hash, wtx))
               if (wtx.fFromMe)
                  fTrickleWait = true;
        }
    in SendMessages() in main.cpp.
 7. Both RelayMessage and RelayInventory in net.h.


--
Search on "Satoshi Client Operation" for more articles in this series.
1480794601
Hero Member
*
Offline Offline

Posts: 1480794601

View Profile Personal Message (Offline)

Ignore
1480794601
Reply with quote  #2

1480794601
Report to moderator
1480794601
Hero Member
*
Offline Offline

Posts: 1480794601

View Profile Personal Message (Offline)

Ignore
1480794601
Reply with quote  #2

1480794601
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480794601
Hero Member
*
Offline Offline

Posts: 1480794601

View Profile Personal Message (Offline)

Ignore
1480794601
Reply with quote  #2

1480794601
Report to moderator
1480794601
Hero Member
*
Offline Offline

Posts: 1480794601

View Profile Personal Message (Offline)

Ignore
1480794601
Reply with quote  #2

1480794601
Report to moderator
1480794601
Hero Member
*
Offline Offline

Posts: 1480794601

View Profile Personal Message (Offline)

Ignore
1480794601
Reply with quote  #2

1480794601
Report to moderator
Kinnardian
Jr. Member
*
Offline Offline

Activity: 38

Founder + CEO, BitBox


View Profile WWW
July 18, 2013, 06:48:32 AM
 #2

Which version of the client are you describing? I'm looking at 0.1.0 and things aren't lining up.

Check out BitBox, let us know what you think: www.BitBox.mx
jaybny
Sr. Member
****
Offline Offline

Activity: 354


coder trader satoshi


View Profile
March 12, 2014, 02:50:13 AM
 #3

any word on the version?

YarkoL
Hero Member
*****
Offline Offline

Activity: 854



View Profile
March 13, 2014, 04:53:08 PM
 #4

I've been studying 0.1.3 source while reading bitrick's posts. It lines up pretty well.

The essential parts are already in place in 0.1.0 though. Just the initialization is different in
later versions.

My first post. Hello world.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!